If you have any question left, please drop a note with the discussion link of this page.
Ruby Client Library
From Wiki.zanox.com
In order to use the zanox Web Services, you will need to use an special authentication scheme with an applicationId and a sharedKey. To accelerate your development efforts we provide a Ruby API Client that you can install and use to simplify monetization of your application. Please see below for how to install and use this official zanox Ruby API client.
Requirements
These gems are the minimum requirements:
- ruby-hmac
Installation
Zanox.rb is a Ruby gem wrapper for the Zanox API. To install via RubyGems, type the following command into your terminal:
gem install zanox
Usage
Copy code examples and edit the code to use your applicationId and sharedKey (shared secret).
Step 1: Include API client and get interface instance
# include zanox API client library require 'zanox' # create a RESTful JSON interface instance @zx = Zanox::Factory.get_interface('json', '2009-02-01') # or create a RESTful XML interface instance @zx = Zanox::Factory.get_interface('xml', '2009-02-01') # or create a SOAP interface instance without version @zx = Zanox::Factory.get_interface('soap')
Step 2: Set up authentication credentials
# set the authentication credentials application_id = 'your_application_id' shared_key = 'your_shared_key' @zx.set_message_credentials(application_id, shared_key)
Example 1: Retrieve a single product item or search for products
# Get a single product item @result = @zx.get_product('76485b5f7021f7bc03b853fbf5debb53') # Search products @result = @zx.search_products('iphone')
Example 2: Create a new adspace
# Create new adspace @adspace_item = { 'name' => 'My new Adspace', 'url' => 'http://www.example.com', 'contact' => 'contact@example.com', 'description' => 'This website contains ...', 'visitors' => 100000, 'impressions' => 5000000, 'type' => 'website', 'scope' => 'business', 'regions' =>{ 'region' => 'de', 'region' => 'en' }, 'categories' => { 'category' => 11, 'category' => 12 } } @result = @zx.create_Adspace(@adspace_item);
Example 3: Update an adspace
# Update adspace item @adspace_item = { 'contact' => 'you@example.com', 'scope' => 'private', 'type' => 'website' } @result = @zx.update_Adspace('your_adspace_id', @adspace_item)
Example 4: Get programs and search programs
# Get all advertiser programs @result = @zx.get_programs # Search programs @result = @zx.search_programs('telecom')
Example 5: Retrieve your payments
# Get your payment history @result = @zx.get_payments
Example 6: Get your profile
# get your zanox profile @result = @zx.get_profile # Update your profile @profile_item = { 'email' => 'you@example.com', 'company' => 'example.com', } @result = @zx.update_profile(@profile_item)