a2z icon indicating copy to clipboard operation
a2z copied to clipboard

Pass Multiple IDs into Item_Lookup

Open austencollins opened this issue 11 years ago • 4 comments

First, I love this gem. What a lifesaver it is! Thank you for all of your hard work. I'm wondering if you could help me whit this issue:

http://stackoverflow.com/questions/18304168/ruby-gem-cant-convert-string-into-integer-error

austencollins avatar Aug 19 '13 00:08 austencollins

Looks like a legit issue, thanks for opening it! I'll take a look and see if I can come up with a quick solution. I really need to build out some tests for this gem so this kind of stuff isn't hit again, I just haven't had time unfortunately.

mhuggins avatar Aug 19 '13 00:08 mhuggins

Taking a quick look, it appears that I'm not accounting for an array in A2z::Responses::Item. I don't have a totally quick fix for this, but for the time being here's what you can do.

  1. Fork this repo.

  2. Edit the A2z::Responses::Item.responses method, and add these 3 lines to the beginning of the method:

    if data.kind_of?(Array)
      return data.map { |item| from_response(item) }
    end
    
  3. Commit your change to your repo, and update your app's Gemfile to reference your forked gem, e.g.:

    gem 'a2z', :github => 'ac360/a2z'
    

When you call @products.item, you'll get an array of items back instead of a single item.

Sorry about the issue and for not having an official fix right this second, but hopefully this will get you by until I can get a true fix in. Thanks again for the report!

mhuggins avatar Aug 19 '13 00:08 mhuggins

Matt, thanks for the quick response and quick fix. Again, this is a great gem and I am getting a ton of value out of it. So, thank you :) I'll play around with the quick fix. Take care!

austencollins avatar Aug 19 '13 14:08 austencollins

I was just about to make a pull request for the same issue, unless one is already in the works @ac360 ?

redroot avatar Feb 28 '14 18:02 redroot