AWS cart operations support in ASIN

It has been a little silent in here lately. This is probably due to my new freelance work as a Rails developer at “Qype.com”:http://qype.com in Hamburg…

Nevertheless, I am proud to announce, that, thx to “Rehanift’s fork”:https://github.com/rehanift/asin, ASIN now support AWS cart operations:

  #just require
  require 'asin'

  # create an ASIN client
  client = ASIN.client

  # create a cart with an item
  cart = client.create_cart({:asin => '1430218150', :quantity => 1})
  cart.items
  => [<#Hashie::Mash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]

  # get an already existing cart from a CartId and HMAC
  cart = client.get_cart('176-9182855-2326919', 'KgeVCA0YJTbuN/7Ibakrk/KnHWA=')
  cart.empty?
  => false

  # clear everything from the cart
  cart = client.clear_cart(cart)
  cart.empty?
  => true

  # add items to the cart
  cart = client.add_items(cart, {:asin => '1430216263', :quantity => 2})
  cart.empty?
  => false

  # update items in the cart
  cart = client.update_items(cart, {:cart_item_id => cart.items.first.CartItemId, :action => :SaveForLater}, {:cart_item_id => cart.items.first.CartItemId, :quantity => 7})
  cart.saved_items
  => [<#Hashie::Mash ASIN="1430218150" CartItemId="U3G241HVLLB8N6" ... >]

You can use the latest source from “GitHub development branch”:https://github.com/phoet/asin/ or download the “beta version of the gem from RubyGems”:https://rubygems.org/gems/asin/versions/0.4.0.beta1. No easter eggs included :)

Happy shopping(cart)!