Amazon Product
Amazon Product is a Nokogiri-backed Ruby wrapper to the Amazon Product Advertising API.
Installation
Add to your Gemfile.
gem 'amazon_product'
Usage
Set up a request.
require "amazon_product"
req = AmazonProduct["us"]
req.configure do |c|
c.key = AMAZON_KEY
c.secret = AMAZON_SECRET
c.tag = AMAZON_ASSOCIATE_TAG
end
Look up a product.
req << { :operation' => 'ItemLookup',
:item_id' => '0679753354' }
resp = request.get
resp = req.find('0679753354')
Consume the entire response.
resp.to_hash
Quickly drop down to a particular node.
resp['Item']
Please see the project page for further detail.
Adapters
Amazon Product defaults to the Net::HTTP library but can be configured to use Curb or EM-HTTP-Request.
Branding is a delicate art
Amazon Product descends from Sucker. While I still like the vacuum metaphor, the name felt tiring after a while.