Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (25 sloc) 1.36 KB

RemoteBook

RemoteBook is a gem for creating affiliate links to Amazon & B&N for books.

Installation

It's a gem. Either run `gem install remote_book` at the command line, or add `gem 'remote_book'` to your Gemfile.

Usage

Get your affiliate digits:

https://affiliate-program.amazon.com/
http://affiliates.barnesandnoble.com/ - sign up with LinkShare, wonder why Amazon is more popular

for rails, add something like this to an initializer

RemoteBook::Amazon.associate_keys = {:associates_id => "me", 
                                     :key_id        => "digits",
                                     :secret_key    => "secret_digits"}

RemoteBook::BarnesAndNoble.associate_keys = {:web_service_token => "token"}
To get the token, login to LinkShare, Links => Web Services (something like: http://cli.linksynergy.com/cli/publisher/links/webServices.php)

Right now it just searches by ISBN, so:

a = RemoteBook::Amazon.find_by_isbn("somedigits")
a.large_image
a.medium_image
a.small_image
a.link
a.author
a.title

b = RemoteBook::BarnesAndNoble.find_by_isbn("digits")
b.link

Barnes And Noble's LinkShare api isn't really much of an API, so all the BN class returns is a link. The Barnes And Noble API is very slow, everything returned from these classes should be cached on your end. You have been warned.