zanox
by Krispin Schulz
The zanox gem is the ruby way to use the zanox API.
It is a wrapper for the zanox Publisher web services and you can use resources like
models in ActiveRecord.
Getting started
- Install the gem
gem install zanox
- Learn its usage with the examples below
- Create shiny ruby apps with it
Features
Supported zanox API methods:
zanox API method | the ruby way |
getAdspaces | Zanox::Adspace.find(:all) |
getAdspace | Zanox::Adspace.find(‘adspace id here’) |
getProgram | Zanox::Program.find(‘program id here’) |
getProgramsByAdspace | Zanox::Program.find(:adspaceId => ‘adspace id here’) |
searchPrograms | Zanox::Program.find(‘amazon’, :region=>’de’) |
getProduct | Zanox::Product.find(‘zupid of the product here’) |
getProducts | Zanox::Product.find(:programId=>’program id is required here’, :adspaceId=>’adspace id here’) |
searchProducts | Zanox::Product.find(‘ipad’, :region=>’de’, :programId=>’a program id here’) |
getSales | Zanox::Sale.find(:date=>’2010-03-02T00:00:00’, :dateType=>’trackingDate’) |
Examples
require 'rubygems'
require 'zanox'
# fill in your credentials
Zanox::API::Session.connect_id = 'your connect id'
Zanox::API::Session.secret_key = 'your secret key'
# request products as easy as hell
Zanox::Product.find('ipod').each do |product|
puts product.id + " : " + product.name
end
# request a product by its zupid
Zanox::Product.find('b84145a6c81a455c99a90194db15aed3').each do |product|
puts product.id + " : " + product.name
end
# get all your zanox adspaces
Zanox::Adspace.find(:all).each do |adspace|
puts adspace.id + " : " + adspace.name
end
For more code snippets look at the files in the examples dir.
License
Published under a Creative Commons license.