mhuggins / a2z

Simple Ruby DSL for searching & retrieving items from the Amazon Product Advertising API
MIT License
41 stars 9 forks source link

Receiving error when attempting to access top sellers and other response groups #6

Closed rceee closed 11 years ago

rceee commented 11 years ago

I'm attempting to access top sellers in a category (in this case, using 1000 as per the example in the documentation). I'm receiving the following:

top_item = node.top_sellers.first
NoMethodError: undefined method `top_sellers' for #<A2z::Responses::BrowseNode:0x007f88dee27098>
rceee commented 11 years ago

Ah, I took a look at the changelog and noticed these features were in the new version.

So, I bundled it from the github version. Now, however, I'm seeing those variables (e.g., @new_releases=[]) but they are empty; should these be working yet?

mhuggins commented 11 years ago

@rceee - make sure you request the proper ResponseGroup per the documentation, i.e.: MostGifted, NewReleases, MostWishedFor, and/or TopSellers. This can be done when looking up the node via:

node = client.browse_node_lookup(1000) do
  response_group 'TopSellers'
end

You can also request multiple response groups by passing a comma-separated string or an array of strings, e.g.:

  response_group 'NewReleases,TopSellers'
  response_group %w(NewReleases TopSellers)  # alternate format

Let me know if you still have trouble!

rceee commented 11 years ago

@mhuggins Yeah, that's among the commands I tried actually; I dunno if it's just me or what; I walked through the exact commands listed for the gem in the Github documentation, and everything worked (ancestor/child methods, so on and so forth–I was getting browsenode records fine) but the response_group methods were returning the undefined method messages. Also worth noting was that as I mentioned, when I did receive the node records, I saw all the ResponseGroups as empty hashes/arrays. I'll try the alternate format next time around and see if it makes a difference. I appreciate the help.

Kudos as always on the great gem.

mhuggins commented 11 years ago

When you received the undefined method error, were you calling response_group from within the context of a browse_node_lookup block? If so, it sounds like a legit error, and I'll reopen the ticket to take a look. Let me know if you notice a difference when trying different formats (array vs. string) as well.