Papapi.configure do |config|
config.uri = 'http://example.com/scripts/server.php'
config.user = '[email protected]'
config.pass = 'password'
end
# Create a new affiliate
affiliate = Papapi::Affiliate.create!(
:username => '[email protected]',
:password => 'password',
:firstname => 'Tom',
:lastname => 'Foolery',
:url => 'http://playpen.com/models/tom-foolery',
:company => 'Foolery INC',
:street => '875 Rodeo Drive',
:city => 'Beverly Hills',
:state => 'CA',
:country => 'US',
:zip => '90210',
:phone => '3234789181',
:refid => 'tom-foolery'
)
puts affiliate.userid # userid is set after creation
# add affiliate to a commission group
affiliate.add_to_commission_group(
campaign_id,
commission_group_id,
:note => 'added by ...'
)
Papapi::Transaction.create!(
:userid => '78392178',
:campaignid => '93847461',
:commtypeid => '10938476',
:totalcost => 1000 # in dollars
)