This gem is a wrapper for the amazon product api so you don't have to figure out how to sign requets.
AmazonProductAPI.set({
aws_access_key: '********************',
aws_secret_key: '****************************************',
associate_tag: '*******-20',
locale: :ca
})
AmazonProductAPI.get({
Operation: 'ItemSearch',
SearchIndex: 'Books',
ResponseGroup: 'Small,Images,AlternateVersions',
Author: 'J K Rowling',
Title: 'Harry Potter'
})
Or use the book shorthand:
AmazonProductAPI.search_book('J K Rowling', 'Harry Potter')
The results come back in a ruby hash:
{"ItemSearchResponse"=>
{"OperationRequest"=>
{"RequestId"=>"12e39370-f0a9-43ac-952e-3655a880fa15",
"Arguments"=>
{"Argument"=> [ .. snip .. ]},
"RequestProcessingTime"=>"1.0705810000000000"},
"Items"=>
{"Request"=>
{"IsValid"=>"True",
"ItemSearchRequest"=>
{"Author"=>"J K Rowling",
"ResponseGroup"=>["Small", "Images", "AlternateVersions"],
"SearchIndex"=>"Books",
"Title"=>"Harry Potter"}},
"TotalResults"=>"786",
"TotalPages"=>"79",
...
Add the following line to your Gemfile
gem 'amazon_product_api', github: 'aj0strow/amazon_product_api'