Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 49 lines (38 sloc) 1.274 kb
#!/usr/bin/ruby -w
#
# $Id: similarity_lookup1,v 1.1 2008/04/27 06:03:54 ianmacd Exp $
require 'amazon/aws'
require 'amazon/aws/search'
include Amazon::AWS
include Amazon::AWS::Search
# Example of a batch operation, using the ASIN as the shared ID.
#
sl = SimilarityLookup.new( [ 'B000AE4QEC', 'B000051WBE' ] )
# You can have multiple response groups.
#
rg = ResponseGroup.new( 'Medium', 'Offers', 'Reviews' )
req = Request.new
req.locale = 'uk'
resp = req.search( sl, rg )
item_sets = resp.similarity_lookup_response[0].items
item_sets.each do |item_set|
item_set.item.each do |item|
attribs = item.item_attributes[0]
puts attribs.label
if attribs.list_price
puts attribs.title, attribs.list_price[0].formatted_price
end
# Availability has become a cumbersome thing to retrieve in AWSv4.
#
puts 'Availability: %s' %
[ item.offers[0].offer[0].offer_listing[0].availability ]
puts 'Average rating: %s' % [ item.customer_reviews[0].average_rating ]
puts 'Reviewed by %s customers.' %
[ item.customer_reviews[0].total_reviews ]
puts 'Customers said:'
item.customer_reviews[0].review.each do |review|
puts ' %s (%s votes)' % [ review.summary, review.total_votes ]
end
puts
end
end
Jump to Line
Something went wrong with that request. Please try again.