Project

dustbag

0.0
No commit activity in last 3 years
No release in over 3 years
A set of response parsers for Vacuum (a wrapper of the Amazon Product Advertising API)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 0
>= 0
>= 0
 Project Readme

Dustbag

Build Status Code Climate Test Coverage

Dustbag is a set of response parsers for Vacumm (a Ruby wrapper of the Amazon Product Advertising API

Vacuum is an excellent client for the Amazon Product Advertising API, it handles all the possible interactons with the API, but unfortunately you're required to implement your own response parse mechanisms. So Vacuum just give us a ton of dust (in form of xml), which is not bad, because that's not its job, dustbag's job is to handle all that dust and give it a meaningful use.

Installation

Add this line to your application’s Gemfile:

gem 'dustbag'

Prerequisite

You'll need credentials to access to the Amazon Product Advertising API, also an affiliate tag, you can get them following this instructions

Once you get your credentials, you'll need to configure Vacuum to use your credentials, you have two options, you can set the following env vars:

export AWS_ACCESS_KEY_ID=key
export AWS_SECRET_ACCESS_KEY=secret

Or, you can explicitly say to vacuum to use your credentials:

request.configure(
    aws_access_key_id: 'key',
    aws_secret_access_key: 'secret',
    associate_tag: 'tag'
)

One more thing, this gem makes use of the Money gem, money makes use of i18n to format money strings, by default this behaviour is disabled, if you want to enable i18n with money, you can enable it by setting the next env var:

export USE_I18N_FOR_MONEY=true

Usage

require 'vacuum'
require 'dustbag'

request = Vacuum.new
request.associate_tag = 'tag'

response = request.item_search(
  query: {
    'Keywords' => 'Architecture',
    'SearchIndex' => 'Books'
  }
)

response.parser = Dustbag::Parser

response.parse

You'll get an ItemSearchReponse object, this object has an 'items' method which is a collection of the Items matchig your search, if you want to see what can you do with these itmes, look at the source code of the Item class

Project status

Right now, there is only one response parser implemented (ItemSearchResponse), the remaining work is to implement the following responses:

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request