No commit activity in last 3 years
No release in over 3 years
A gem for communicating with Affiliate Window's Publisher Service API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.10
~> 11.3
~> 3.5
~> 3.0
~> 2.1

Runtime

~> 2.11
 Project Readme

## Affiliate Window

This gem lets you make requests to Affiliate Window's Publisher Service API. At the time of writing, it is on version 6. The API is documented here.

There is an existing gem for communicating with Affiliate Window but it looks to be unsupported and doesn't work with its Publisher Service API.

Usage

client = AffiliateWindow.login(
  account_id: 1234,
  affiliate_api_password: "your api key",
)

response = client.get_transaction_list(
  start_date: "2006-08-04T00:00:00",
  end_date: "2006-08-14T23:59:59",
  date_type: "transaction",
)

response.dig(:results, :transaction, 0)
#=> {
#  i_id: "1",
#  s_status: "confirmed",
#  b_paid: true,
#  m_sale_amount: {
#    d_amount: "50.00",
#    s_currency: "GBP"
#  },
#  ...

The gem follows the convention that all API methods are called by their snake case name. Parameter names mirror the API, for example:

iMerchantId -> merchant_id
aTransactionIds -> transaction_ids
aStatus -> status

If the endpoint returns metadata about how many records were returned, this is returned in the pagination key of the output, e.g.

response
#=> {
#  pagination: {
#    i_rows_returned: "10",
#    i_rows_available: "50"
#  }

Quota

The API provides a daily quota of 15,000 requests per account. The remaining quota is returned in the header of each response. If this quota is reached, subsequent requests to the API will raise errors.

You can check the remaining quota with:

client.remaining_quota
#=> 14997

Debugging

You can print the SOAP request bodies by enabling debug mode:

client.debug = true
client.get_merchant_list
# <?xml version='1.0' encoding='UTF-8'?>
# ...