Ruby Amazon book search
I've been using Amazon/ECS with great success. One important point is that it's not GPLed (whereas Ruby/AWS seems to be), so if it's important in your case, take care.
Here is a sample:
require 'amazon/ecs'
# default options; will be camelized and converted
# to REST request parameters.
Amazon::Ecs.options = {:aWS_access_key_id => [your access key]}
res = Amazon::Ecs.item_search('ruby')
You may also want to have a look at some example of integration with the Mephisto blogging system.
cheers!
Amazon Book API for Python or Ruby?
I think I found a couple of options for you.
The Ruby option:
The library provides support for the vast majority of the AWS v3.1 API. For example, all forms of product search are implemented, along with the transaction details API and the remote shopping-cart API. Furthermore, advanced features such as threaded retrieval of multiple pages, object caching and determining a client's most appropriate AWS locale are all available.
http://www.caliban.org/ruby/ruby-amazon.shtml
The Python option:
The Product Advertising API helps you advertise Amazon products using product search and look up capability, product information and features such as Customer Reviews, Similar Products, Wish Lists and New and Used listings.
http://pypi.python.org/pypi/python-amazon-product-api/0.2.1
Hopefully these can help you out. =)
Values of a book saved from amazon have {:value=} around it
I don't think the hidden field tag is right.
<%= hidden_field_tag :title, class: 'form-control', value: result.name %>
Try
<%= hidden_field_tag :title, result.name %>
Paginate the results from Amazon product search
From their API page at - http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl
They have "RelatedItemPage" and "ItemPage"
You should give this a try
resp = req.search("Books", :power => params[:book][:search_term], :itemPage => 20)
Hope this helps.
Amazon API and hardcover versus paperback
I will assume you know how to set up the Amazon Product gem request object correctly. from there, you can do...
search = req.search( 'Ender\'s Game' )
search.each('Item') do |item|
asin = item["ASIN"]
title = item['ItemAttributes']['Title']
hash = {
:response_group => ['ItemAttributes']
}
items = req.find( asin, hash )
items.each('Item') do |ia|
puts "[#{asin}]: #{title} => [#{ia['ItemAttributes']['Binding']}]"
end
end
which produces output like
[0812550706]: Ender's Game (Ender, Book 1) => [Mass Market Paperback]
[0765362430]: The Ender Quartet Box Set: Ender's Game, Speaker for the Dead, Xenocide, Children of the Mind => [Mass Market Paperback]
[0812550757]: Speaker for the Dead (Ender, Book 2) => [Mass Market Paperback]
[0765342405]: Ender's Shadow (Ender, Book 5) => [Paperback]
[B003G4W49C]: Ender's Game => [Kindle Edition]
[0785135820]: Ender's Game: Command School => [Hardcover]
[0785135804]: Ender's Game: Battle School (Ender's Game Gn) => [Hardcover]
[0765362449]: The Ender's Shadow Series Box Set: Ender's Shadow, Shadow of the Hegemon, Shadow Puppets, Shadow of the Giant => [Paperback]
[0785136096]: Ender's Game: Formic Wars: Burning Earth => [Hardcover]
[0812565959]: Shadow of the Hegemon (Ender, Book 6) => [Mass Market Paperback]
Rails: Implement Search/Filter like Amazon.com
This approach is often called 'faceted' search. Try:
- http://railscasts.com/episodes/306-elasticsearch-part-1
- http://railscasts.com/episodes/307-elasticsearch-part-2
- https://github.com/elasticsearch/elasticsearch-ruby
Related Topics
How to Set a Request.Referrer Inside My Rspec
Split Array Up into N-Groups of M Size
Best Way to Work with Large Amounts of CSV Data Quickly
Multiple Level Nested Layout in Rails 3
How to Get the File Extension from a Url
How to Get Words Frequency in Efficient Way with Ruby
How to Store Enum as String to Database in Rails
Advice on Using Modules with Ruby on Rails
Does Rails Come with a "Not Authorized" Exception
Active Record with Delegate and Conditions
How to Return Correct Http Error Codes from Ruby on Rails Application
Parsing JSON Without Quoted Keys
How to Detect User Agent in Rails 3.1
Rails Custom Validation - Only One Record Can Be True