This post originated from an RSS feed registered with Ruby Buzz
by Jonathan Weiss.
Original Post: MeinProf featured on the German Amazon Affiliate Blog
Feed Title: BlogFish
Feed URL: http://blog.innerewut.de/feed/atom.xml
Feed Description: Weblog by Jonathan Weiss about Unix, BSD, security, Programming in Ruby, Ruby on Rails and Agile Development.
We use the ECS API to let professors and students search for books and study guides on Amazon and then recommend the books to other students. So besides rating a course a student can also recommend supporting literature to others. This is the first step in our plans to increase MeinProfs value to students. We introduced this feature only a short while ago but already have many professors who register and recommend books to their students through our system.
The implementation uses the amazon-ecs ruby library that internally uses Hpricot, the great HTML/XML parser by _why.
The basic usage looks like this:
require 'amazon/ecs'
Amazon::Ecs.options = {
:aWS_access_key_id => SECRET_KEY,
:associate_tag => ASSOCIATE_TAG,
:response_group => 'Medium',
:country => :de
}
result_set = Amazon::Ecs.item_search('Programming Ruby', {
:search_index => 'Books' # use Blended if you want also foreign books (usefull in DE and FR)
})
if result_set.has_errors?
raise "Problem with ECS!"
end
result_set.items.each do |item|
puts item.get('title')
puts item.get('asin')
puts item.get('detailpageurl')
end
The difficult part is filtering and pre-processing the search term entered by the user in order to reduce the result set.