Sha256: b1124f9a76063b902151a191de4e774cc16f71a1b87a1edefe1a40f1fcffb90a

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

# Vacuum

Vacuum is a [Nokogiri][1]-backed Ruby wrapper to the [Amazon Product
Advertising API] [2].

[![travis](https://secure.travis-ci.org/hakanensari/vacuum.png)](http://travis-ci.org/hakanensari/vacuum)

## Installation

Add to your Gemfile.

    gem 'vacuum'

## Usage

Set up a request.

    require "vacuum"

    req = Vacuum["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 => 'ItemAttributes',
                              :power          => 'George Orwell'

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

Consume the entire response.

    res.to_hash

Quickly drop down to a particular node.

    res.each('Item') do |item|
      puts item['ASIN']
    end

[Please see the project page] [4] for further detail.

[1]: http://nokogiri.org/
[2]: https://affiliate-program.amazon.co.uk/gp/advertising/api/detail/main.html
[3]: https://github.com/hakanensari/vacuum/blob/master/lib/vacuum/operations.rb
[4]: http://code.papercavalier.com/vacuum/

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vacuum-0.0.1 README.md