A wrapper around the item search and lookup functionalities of the ruby-aaws gem
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
LICENSE
README.textile
Rakefile
init.rb

README.textile

Amazon Products

Overview

Use this library if you want to pull down information (via searches or specific product lookup) about products on Amazon.

Prerequisites

ruby-aaws gem (sudo gem install ruby-aaws)

You will need an AWS access key ID. The location of this will need to be configured much like what is shown below.

Usage

The yaml file containing your access_key_id should look something like this:

access_key_id: your-key-here

There is no default location for the config file, so you must supply the location somewhere in your app like so:

AmazonProducts.config_location = 'config/amazon.yml'

You can search for products like this:

  require 'amazon_products'
  search = AmazonProducts::Search.new('Books', 'knitting')
  results = search.execute
  @first_result = results.first

Then in an HTML template somewhere, assuming you wanted to use an image from one of your results:

<img src="#{@first_result.medium_image.url}"/>

The individual item lookup works about the same:

require 'amazon_products'
lookup = AmazonProducts::Lookup.new('0834003503', 'ISBN')
@result = lookup.execute

Caveats

Right now there is only support for Books, DVDs, Music and VideoGames (those are all I need right now :-)