github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jugend / amazon-ecs

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 56
    • 8
  • Source
  • Commits
  • Network (8)
  • Issues (1)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Generic Ruby Amazon E-commerce REST API — Read more

  cancel

http://www.pluitsolutions.com/projects/amazon-ecs

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Update package version to 0.5.7 
Herryanto Siatono (author)
Thu Aug 27 09:07:35 -0700 2009
commit  10029a45dac125c58d0c272d35334267b56e6d6b
tree    10716dcc52629604f3f98cd0ea15d68d9e3caf39
parent  5385c86070415139811f13aabdd0d8cff2678c9e
amazon-ecs /
name age
history
message
file CHANGELOG Thu Aug 27 09:05:37 -0700 2009 Add support to sign request with openssl with f... [Herryanto Siatono]
file MIT-LICENSE Fri Jan 23 19:54:22 -0800 2009 first commit [Herryanto Siatono]
file README Thu Aug 27 09:05:37 -0700 2009 Add support to sign request with openssl with f... [Herryanto Siatono]
file Rakefile Thu Aug 27 09:07:35 -0700 2009 Update package version to 0.5.7 [Herryanto Siatono]
file amazon-ecs.gemspec Sat Jun 20 23:43:54 -0700 2009 Update to the README and a gemspec file - as pe... [dkam]
directory doc/ Fri Jan 23 19:54:22 -0800 2009 first commit [Herryanto Siatono]
directory lib/ Thu Aug 27 09:05:37 -0700 2009 Add support to sign request with openssl with f... [Herryanto Siatono]
directory test/ Thu Aug 27 09:05:37 -0700 2009 Add support to sign request with openssl with f... [Herryanto Siatono]
README
== amazon-ecs

Generic Amazon E-commerce REST or Product Advertising API using Hpricot with configurable 
default options and method call options. Uses Response and 
Element wrapper classes for easy access to REST XML output.

It is generic, so you can easily extend <tt>Amazon::Ecs</tt> to support 
other not implemented REST operations; and it is also generic because it just wraps around
Hpricot element object, instead of providing one-to-one object/attributes to XML elements map.

If in the future, there is a change in REST XML output structure, 
no changes will be required on <tt>amazon-ecs</tt> library, 
instead you just need to change the element path.

Version: 0.5.7

== INSTALLATION

  $ gem install amazon-ecs

== EXAMPLE

    require 'amazon/ecs'
  
    # set the default options; options will be camelized and converted to REST request parameters.
    Amazon::Ecs.options = {:aWS_access_key_id => [your access key]}

    # to generate signed requests include your secret key:
    Amazon::Ecs.options = {:aWS_access_key_id => [your developer token], :aWS_secret_key => [your secret access key]}

    # alternatively,
    Amazon::Ecs.configure do |options|
        options[:aWS_access_key_id] = [your access key]
        options[:aWS_secret_key] = [you secret key]
    end

    # options provided on method call will merge with the default options
    res = Amazon::Ecs.item_search('ruby', {:response_group => 'Medium', :sort => 'salesrank'})

    # some common response object methods
    res.is_valid_request?     # return true if request is valid
    res.has_error?            # return true if there is an error
    res.error                 # return error message if there is any
    res.total_pages           # return total pages
    res.total_results         # return total results
    res.item_page             # return current page no if :item_page option is provided

    # traverse through each item (Amazon::Element)
    res.items.each do |item|
      # retrieve string value using XML path
      item.get('asin')
      item.get('itemattributes/title')

      # or return Amazon::Element instance
      atts = item.search_and_convert('itemattributes')
      atts.get('title')
  
      # return first author or a string array of authors
      atts.get('author')          # 'Author 1'
      atts.get_array('author')    # ['Author 1', 'Author 2', ...]
  
      # return an hash of children text values with the element names as the keys
      item.get_hash('smallimage') # {:url => ..., :width => ..., :height => ...}
  
      # note that '/' returns Hpricot::Elements array object, nil if not found
      reviews = item/'editorialreview'
  
      # traverse through Hpricot elements
      reviews.each do |review|
        # Getting hash value out of Hpricot element
        Amazon::Element.get_hash(review) # [:source => ..., :content ==> ...]
    
        # Or to get unescaped HTML values
        Amazon::Element.get_unescaped(review, 'source')
        Amazon::Element.get_unescaped(review, 'content')
        
        # Or this way
        el = Amazon::Element.new(review)
        el.get_unescaped('source')
        el.get_unescaped('content')
      end
      
      # returns Amazon::Element instead of string
      item.search_and_convert('itemattributes').
    end

Refer to Amazon ECS documentation for more information on Amazon REST request parameters and XML output:
http://docs.amazonwebservices.com/AWSEcommerceService/2006-09-13/

To get a sample of Amazon REST response XML output, use AWSZone.com scratch pad:
http://www.awszone.com/scratchpads/aws/ecs.us/index.aws

== SOURCE CODES

* http://github.com/jugend/amazon-ecs/tree/master

== LINKS

* http://github.com/jugend/amazon-ecs
* http://amazon-ecs.rubyforge.org
* http://www.pluitsolutions.com/amazon-ecs

== CREDITS

Thanks to Dan Milne (http://da.nmilne.com/) for the signed request patch.

== LICENSE

(The MIT License)

Copyright (c) 2009 Herryanto Siatono, Pluit Solutions
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server