/ROmniture

A Ruby library that allows access to Omniture's REST API libraries (developer.omniture.com)

Primary LanguageRuby

romniture

To be pronounced...RAWWWRROMNITURE

what is it

romniture is a minimal Ruby wrapper to Omniture's REST API. It follows a design policy similar to that of sucker built for Amazon's API.

Omniture's API is closed, you have to be a paying customer in order to access the data.

installation

[sudo] gem install romniture

initialization and authentication

romniture requires you supply the username, shared_secret and environment which you can access within the Company > Web Services section of the Admin Console. The environment you'll use to connect to Omniture's API depends on which data center they're using to store your traffic data and will be one of:

Here's an example of initializing with a few configuration options.

client = ROmniture::Client.new(
  username, 
  shared_secret, 
  :san_jose, 
  :verify_mode	=> nil	# Optionaly change the ssl verify mode.
  :log => false,    		# Optionally turn off logging if it ticks you off
  :wait_time => 1   		# Amount of seconds to wait in between pinging 
                    		# Omniture's servers to see if a report is done processing (BEWARE OF TOKENS!)
  )

usage

There are only two core methods for the client which doesn't try to "over architect a spaghetti API":

  • get_report - used to...while get reports and
  • request - more generic used to make any kind of request

For reference, I'd recommend keeping Omniture's Developer Portal open as you code . It's not the easiest to navigate but most of what you need is there.

The response returned by either of these requests Ruby (parsed JSON).

examples

# Find all the company report suites
client.request('Company.GetReportSuites')

# Get an overtime report
client.get_report "Report.QueueOvertime", {
  "reportDescription" => {
    "reportSuiteID" => "#{@config["report_suite_id"]}",
    "dateFrom" => "2011-01-01",
    "dateTo" => "2011-01-10",
    "metrics" => [{"id" => "pageviews"}]
    }
  }

see also

My other client library comscore_ruby for those of you looking to pull data from comscore as well.