0

I am trying to use the MindBody Gem but when I attempt to run: $ gem install mindbody-api I see the error:

$ gem install mindbody-api
ERROR:  Could not find a valid gem 'mindbody-api' (>= 0) in any repository

I've been able to get it working in my gemfile by including the path of the GitHub page: gem 'mindbody-api', :git => 'git://github.com/wingrunr21/mindbody-api.git' and I am successful when I run bundle install but I've noticed that my version is missing a function that is present in the GitHub Repo, specifically:

MindBody::Services::SaleService.checkout_shopping_cart(search_creds)
NoMethodError: undefined method `checkout_shopping_cart' for MindBody::Services::SaleService:Class

despite the function being listed on the GitHub repo SaleService page. Any idea what I should try next?

Jeremy Thomas
  • 6,240
  • 9
  • 47
  • 92

2 Answers2

2

In your comment under the question it shows that you have older version of the gem: rvm/gems/ruby-2.2.3@awaken/bundler/gems/mindbody-api-579af18314d2.

So if you browse the repo at this point of time (579af18314d2) you will see that the method does not exist yet - link

In order to fix it you need to update it to thelatest version, which you can do by:

bundle update --source mindbody-api

Also to verify that you have the latest version when you do bundle show mindbody-api it should show something like: .rvm/gems/ruby-2.2.3@awaken/bundler/gems/mindbody-api-f58110f2b255

Viktor Nonov
  • 1,472
  • 1
  • 12
  • 26
  • is there a way to do this directly in the gemfile? I've trying uninstalling and reinstalling but seem to constantly end up with the same version – Jeremy Thomas Dec 17 '18 at 16:38
  • 1
    I was able to update using `bundle update --source mindbody`. Please add to your response – Jeremy Thomas Dec 17 '18 at 16:47
  • 1
    sure. Change the line in the Gemfile to: `gem 'mindbody-api', :git => 'git://github.com/wingrunr21/mindbody-api.git', :ref => 'f58110f2b255'` – Viktor Nonov Dec 17 '18 at 16:47
0

Regarding the install:

The only version released is an alpha release, that's why you can't install it. You can, however, install the alpha version with:

gem install mindbody-api -v 1.0.1.alpha

Regarding the method missing:

It appears there is a bug in the way the operations are loaded. I was able to get the method loaded under certain circumstances (cloning & building myself, I think) but even then the behavior wasn't consistent.

The gem hasn't had any significant major updates in a few years. It's not clear if the gem is maintained but I think your best bet might be to create a github repo issue, or fork & fix it yourself.

Jay Dorsey
  • 3,563
  • 2
  • 18
  • 24
  • hmm I get the same response for all of those functions. `get_all_opertations` throws a `NoMethodError` as well – Jeremy Thomas Dec 17 '18 at 14:51
  • @JeremyThomas you're right, I tried it on a different machine and I get that same error as well. It's possible that the published version doesn't match the repository version. I may have confused my testing when building the gem from the repo, versus the installed gem. I'm updating my answer to remove that check and leave it at simple "There's a bug". The gem doesn't have any recent major activity so it may be necessary to do some refactoring to make this work. – Jay Dorsey Dec 17 '18 at 16:01