Giter Club home page Giter Club logo

affiliate_window's Introduction

## 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'?>
# ...

affiliate_window's People

Contributors

tuzz avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.