Tucano

When taking part in a hackathon recently I was looking for a simple gem to pull products from Amazon based on a search string. I found a few but none did exactly what I wanted, so I built this one. Tucano simply gives you an array of items with basic attributes.

Installation

gem install tucano

Usage

Before you start you will need an Amazon Product Advertising key, which you can aquire by signing up here. You will also need and Affiliate Tag. Get one here.

Once all thats set up you can create a new Tucano Search object using your details:

tucano = Tucano::ProductSearch.new('api-key', 'secret, affiliate-tag')

Now it's as simple as searching:

products = tucano.search("Ruby Book")

This returns an Array of Tucano::Items with names, prices, currency, category and a large image.

product = products.first

=> Tucano::Item:0x007fb5e40edde0 @name="Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series)", @category="Book", @price="3999", @currency="USD", @image="http://ecx.images-amazon.com/images/I/51TEzGZ%2BggL.jpg, @url="http://www.amazon.com/Ruby-Rails-Tutorial-Addison-Wesley-Professional/dp/0321743121%3FSubscriptionId%3DAKIAJ5HO5KJC4OISP7WQ%26tag%3Dvoicsear-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321743121""

So you can do stuff like:

product.name => "Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series)"

Price #{product.price/100} #{product.currency} => 39.99USD

The gem is still slightly unstable but I hope that I (or indeed you guys) can sort it out over the next few days.

Contributing to Tucano

Copyright © 2012 Mark Provan. See LICENSE.txt for further details.