Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (35 sloc) 1.772 kb


Ruby Amazon Alexa web service REST API using Hpricot with configurable default options and method call options. Uses Response and Element wrapper classes for easy access to REST XML output.

This version is based on but I didn't like how it was possible to globally alter options. The AWS_ACCESS_KEY_ID and AWS_SECRET_KEY are still global since one will likely only want to initialize these once.


$ gem install gaiottino-amazon-awis


require 'rubygems'
require 'amazon/awis'

# set the default config; config will be camelized and converted to REST request parameters.
Amazon::Awis.configure do |config|
  config[:aws_access_key_id] = AWS_ACCESS_KEY_ID
  config[:aws_secret_key] = AWS_SECRET_KEY

# create an instance of Awis for a specific action and domain
awis ={ :action => :url_info, :domain => '' })

# call query with the Response Group you want
resp = awis.query(:rank)

# some common response object methods        
res.is_success?   # return true if request was successful

#dynamic methods
res.rank          # return the rank of domain name that was passed
res.dataurl	      # returns the url which was queried

# Query another action/domain after updating the options
awis.options[:domain] = ''

Refer to Amazon AWIS documentation for more information on Amazon REST request parameters and XML output:



(The MIT License)

Copyright © 2010 Daniel Gaiottino (Based on the initial work by Hasham Malik)

Jump to Line
Something went wrong with that request. Please try again.