#!/usr/bin/ruby -w
#
# $Id: search,v 1.2 2004/01/18 09:24:30 ianmacd Exp $

require 'amazon'

include Amazon::Search

ASSOCIATES_ID = "webservices-20"    # use this if you have no Associates
				    # account of your own
				       
DEV_TOKEN     = "D23XFCO2UKJY82"    # your development token

search  = 'angelina jolie'
mode    = 'books'
heavy	= true
lite	= false
                                     
req = Request.new(ASSOCIATES_ID, DEV_TOKEN)

searches = [
  ['ruby programming', 'books', heavy, KEYWORD_SEARCH, 'Keyword'],
  ['angelina jolie', 'dvd', heavy, ACTOR_SEARCH, 'Actor'],
  ['stranglers', 'music', heavy, ARTIST_SEARCH, 'Artist'],
  ['0971394253', nil, heavy, ASIN_SEARCH, 'ASIN'],
  ['602360', 'magazines', heavy, NODE_SEARCH, 'Browse node'],
  ['iain banks', 'books', heavy, AUTHOR_SEARCH, 'Author'],
  ['oliver stone', 'video', heavy, DIRECTOR_SEARCH, 'Director'],
  ['red hat', 'software', heavy, MANUFACTURER_SEARCH, 'Manufacturer'],
  ['10AHWTZSWG8NC', nil, heavy, LISTMANIA_SEARCH, 'Listmania'],
  ['0596005423', nil, heavy, SIMILARITY_SEARCH, 'Similarity'],
  ]

searches.each do |s|
  printf(%Q(\nHit [Enter] for %s search on "%s"%s:\n\n), s.pop, s[0],
	 (s[1].nil? ? "" : " using %s mode" % s[1]))
  $stdin.gets
  p req.search(*s).parse
end

