Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 amazon_product.gemspec
README.md

Amazon Product

Amazon Product is a Nokogiri-backed Ruby wrapper to the Amazon Product Advertising API.

travis

 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

Search for something.

req << { :operation    => 'ItemSearch',
         :search_index => 'All',
         :keywords     => 'George Orwell' }
res = request.get

Or use a shorthand.

res = req.search('George Orwell')

Customise your request.

res = req.search('Books', :response_group => %w{ItemAttributes Images},
                          :power          => 'George Orwell'

For a reference of available methods and syntax, read here.

Consume the entire response.

res.to_hash

Quickly drop down to a particular node.

res['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.

Something went wrong with that request. Please try again.