2Performant networks can be integrated in any web application.
This Ruby wrapper provides a simple way of interacting with the API.
Get the API from Github
(git clone git://github.com/2performant/2Performant-ruby.git)
Examples:
require 'rubygems'
require 'two_performant'
# create a session via OAuth
tp = TwoPerformant.new(:oauth, {
:consumer_token => token,
:consumer_secret => secret,
:access_token => access_token,
:access_secret => access_secret
}, 'http://example.com')
# or via Simple HTTP Authentication
tp = TwoPerformant.new(:simple, { :user => username, :pass => password }, 'http://example.com')
# Merchants: show own campaigns
tp.campaigns_listforowner
# Affiliates: show site with ID 1
tp.site_show('1')
# Merchants: create a Text Ad in the campaign with ID 2
txtad = { :title => "Title", :content => "Content", :url => "www.google.com", :help => "Help and Suggestions" }
tp.txtad_create(2, txtad)
# Affiliates: update a site
tp.site_update('1', { :name => 'I love lucy' })
# Affiliates: delete a site
tp.site_destroy('13')