#!/usr/bin/ruby -w
#
# $Id: rcart,v 1.3 2006/08/05 09:26:11 ianmacd Exp $
#
# This will take one or more valid ASINs on amazon.com and spit out a URL
# that, when entered into a browser, will upload a remote shopping cart
# containing the corresponding items to the user's Amazon shopping cart.

require 'amazon/shoppingcart'

if ARGV.empty?
  $stderr.puts "Usage: rcart <asin>+"
  exit 1
end

sc = Amazon::ShoppingCart.new

ARGV.each { |asin| sc.add_items(asin, 1) }

puts sc.purchase_url
