Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A Ruby client for the AffiliateWindow API
branch: master



This Ruby gem contains clients for the AffiliateWindow ( suite of APIs and webservices. It currently supports:

  • AffiliateService (SOAP)

  • Merchant and category meta-data

  • ShopWindow data feeds.

Getting started

Configure an account for the gem to use with all clients. If you're working with Rails, you could do this in an initializer:

AffiliateWindow.account =
  :user => '12345', 
  :datafeed_password => 'e9db...', 
  :api_key => 'fc70...',
  :api_password => 'dc3024ea...'



To get all today's transactions with the AffiliateService SOAP client:

client =
response = client.request(:get_transaction_list) do
  soap.body = { 
    :d_start_date =>, 
    :d_end_date =>, 
    :s_date_type => 'transaction'

puts r.to_hash

This outputs something like:

{:get_transaction_list_response=>{:get_transaction_list_return=>{:transaction=>{:i_id=>"72417910", :s_status=>"pending", :s_type=>"normal", :s_ip=>"", :b_paid=>false, :i_payment_id=>"0", :i_merchant_id=>"9999", :f_sale_amount=>"318.74", :f_commission_amount=>"9.56", :d_click_date=>"2012-05-26 19:48:30", :d_transaction_date=>"2012-05-26 20:41:03", :s_clickref=>"4fc125b25ef7f37589000ac7", :a_transaction_parts=>{:transaction_part=>{:s_commission_group_name=>"Default Commission", :f_sale_amount=>"318.74", :f_commission_amount=>"9.56", :i_commission=>"3", :s_commission_type=>"percentage"}}}}, :get_transaction_list_count_return=>{:i_rows_returned=>"1", :i_rows_available=>"1"}}}


To download a product feed CSV for a set of merchants:

store_to = "tmp/"
client = => [1,2,3,4])

Merchants and categories

Merchants: { |merchant| puts merchant.inspect }

Categories: { |category| puts merchant.inspect }


There's currently only a Transaction model, and this is a work in progress.


  • Use VCR for test coverage

  • Extend test coverage to actually connect to API with real URLs and test responses, to protect against API changes.

  • Handle 'merchant' user type for AffiliateService authentications.

In production

This is in production use on If you're using this, let me know.

Contributing to affiliate-window

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.


Copyright © 2011 See LICENSE.txt for further details.

Something went wrong with that request. Please try again.