mhuggins / a2z

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

a2z not working with ruby 2.0.0-p353 and rails 4.0.1 #10

Closed naimrajib07 closed 10 years ago

naimrajib07 commented 10 years ago

I am working with amazon product api and use this gem. It is not compitable with the specified version of ruby and rails.

It shows "key=" is not define when i am initiate client like bellow:

client = A2z::Client.new(key: 'My_KEY', secret: 'My_SECRET', tag: 'My_TAG')

Any idea?

mhuggins commented 10 years ago

I've just released version 0.1.3, which fixes an issue with the jeff gem dependency (which is what was causing the key= error). I also updated the travis CI build to ensure it works with ruby-2.0.0, and it does. Let me know if you run into any issues!

naimrajib07 commented 10 years ago

It is working now. But search return nothing. Always it is nil. I am searching using your default example but no luck. AFAK, it was works good :)

esponse = client.item_search do category 'Music' keywords 'Dave Matthews Band' end

<A2z::Responses::ItemSearch:0xa8fa610 @items=[], @total_results=0, @total_pages=0, @valid=false, @operation_request=#<A2z::Responses::OperationRequest:0xa8fa4e4 @headers={"UserAgent"=>"Jeff/0.6.4 (Language=Ruby; naim)"}, @arguments={"Operation"=>"ItemSearch", "Service"=>"AWSECommerceService", "AssociateTag"=>"xxxxxx", "Version"=>"2011-08-01", "Keywords"=>"Dave Matthews Band", "SignatureMethod"=>"HmacSHA256", "SearchIndex"=>"Music", "SignatureVersion"=>"2", "Signature"=>"xxxxxxxxxxxxxxxxxx", "AWSAccessKeyId"=>"xxxxxxxxxxxxxxxxx", "Timestamp"=>"2013-12-08T05:02:29Z"}, @request_id="e9bc856c-13fd-40fc-a4b4-e504c6abd3c9", @request_processing_time=0.00757>, @more_search_results_url=nil>

mhuggins commented 10 years ago

I just tried it and it worked for me. Maybe check that your key & secret are correct? Or perhaps there was just an intermittent failure on Amazon's side.

client = A2z::Client.new(key: 'XXX', secret: 'XXX', tag: 'XXX')
response = client.item_search do
  category 'Music'
  keywords 'Dave Matthews Band'
end
response.items.size             # => 10
item = response.items.first     # => #<A2z::Responses::Item:0x007f81eabfe9b0 ...>
item.keys                       # => ["artist", "manufacturer", "product_group", "title"]
item.title                      # => "Away From The World (Deluxe Version)"
item.artist                     # => "Dave Matthews Band"
item.manufacturer               # => "RCA"
item.product_group              # => "Music"
item.links.size                 # => 7
naimrajib07 commented 10 years ago

Thanks for your help :) would you please mention me, how i get a list of videogames for preorders? I am looking for data from this link: http://www.amazon.com/New-Future-Releases/b/ref=sv_vg_12?ie=UTF8&node=496994 and then from:

        http://www.amazon.com/s/ref=amb_link_365592482_2?ie=UTF8&bbn=14220161&field-releasedate=1y-700y&node=14220161&page=1&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=left-2&pf_rd_r=0CZ09MGT5FA2J6P2H5E1&pf_rd_t=101&pf_rd_p=1583568422&pf_rd_i=496994

How i search this? is it get by using node look up searching? but it doesn't give me preorder data. Here i mean preorder data is a data of games that is not released yet.

I need the data from the following:

Browse Pre-orders Pre-order by console Xbox One Xbox 360 PlayStation 4 PlayStation 3 PlayStation Vita Wii U Wii Nintendo 3DS Nintendo DS

Thanks and appreciate your work.

mhuggins commented 10 years ago

According to this page, there's only a way to filter on the "Availability" option is by setting it to "Available", or to just not provide it at all. There might be a CategoryID you can pass though for this section of the site, if you can figure it out.

The only other thing I could figure out was that clicking the "more" link is searching based upon a release date, which appears like it might represent a future date range. Unfortunately, I didn't see anything in the ItemSearch docs that appeared to relate to such a field.

You might be out of luck in that it's not something exposed by Amazon, but if you can figure it, please share!