class AffiliateWindow

For full API documentation, refer to: wiki.affiliatewindow.com/index.php/Publisher_Service_API

Constants

VERSION

Attributes

client[RW]
debug[RW]
error_handler[RW]
parser[RW]
remaining_quota[RW]

Public Class Methods

login(account_id:, affiliate_api_password:) click to toggle source
# File lib/affiliate_window/base.rb, line 7
def self.login(account_id:, affiliate_api_password:)
  client = Client.new(
    account_id: account_id,
    affiliate_api_password: affiliate_api_password,
  )

  new(client: client)
end
new(client:, error_handler: ErrorHandler, parser: Parser) click to toggle source
# File lib/affiliate_window/base.rb, line 16
def initialize(client:, error_handler: ErrorHandler, parser: Parser)
  self.client = client
  self.error_handler = error_handler
  self.parser = parser
end

Public Instance Methods

get_click_stats(start_date:, end_date:, merchant_ids: nil, date_type:, offset: nil, limit: nil) click to toggle source

Gets the requested link click stats wiki.affiliatewindow.com/index.php/AS:getClickStats

# File lib/affiliate_window/base.rb, line 91
def get_click_stats(start_date:, end_date:, merchant_ids: nil, date_type:, offset: nil, limit: nil)
  call(
    :get_click_stats,
    dStartDate: start_date,
    dEndDate: end_date,
    aMerchantIds: merchant_ids,
    sDateType: date_type,
    iOffset: offset,
    iLimit: limit,
  )
end
get_commission_group(merchant_id:, commission_group_code:) click to toggle source

Gets the commission values for a given commission group and advertiser wiki.affiliatewindow.com/index.php/AS:getCommissionGroup

# File lib/affiliate_window/base.rb, line 24
def get_commission_group(merchant_id:, commission_group_code:)
  call(
    :get_commission_group,
    iMerchantId: merchant_id,
    sCommissionGroupCode: commission_group_code,
  )
end
get_commission_group_list(merchant_id:) click to toggle source

Gets an array of commission groups for an advertiser wiki.affiliatewindow.com/index.php/AS:getCommissionGroupList

# File lib/affiliate_window/base.rb, line 34
def get_commission_group_list(merchant_id:)
  call(:get_commission_group_list, iMerchantId: merchant_id)
end
get_impression_stats(start_date:, end_date:, merchant_ids: nil, date_type:, offset: nil, limit: nil) click to toggle source

Gets the requested link impression stats wiki.affiliatewindow.com/index.php/AS:getImpressionStats

# File lib/affiliate_window/base.rb, line 105
def get_impression_stats(start_date:, end_date:, merchant_ids: nil, date_type:, offset: nil, limit: nil)
  call(
    :get_impression_stats,
    dStartDate: start_date,
    dEndDate: end_date,
    aMerchantIds: merchant_ids,
    sDateType: date_type,
    iOffset: offset,
    iLimit: limit,
  )
end
get_merchant(merchant_ids:) click to toggle source

Gets the requested advertisers wiki.affiliatewindow.com/index.php/AS:getMerchant

# File lib/affiliate_window/base.rb, line 66
def get_merchant(merchant_ids:)
  call(:get_merchant, aMerchantIds: merchant_ids)
end
get_merchant_list(relationship: nil) click to toggle source

Gets the advertisers that fall under the specified criteria wiki.affiliatewindow.com/index.php/AS:getMerchantList

# File lib/affiliate_window/base.rb, line 72
def get_merchant_list(relationship: nil)
  call(:get_merchant_list, sRelationship: relationship)
end
get_transaction(transaction_ids:) click to toggle source

Gets the requested transactions wiki.affiliatewindow.com/index.php/AS:getTransaction

# File lib/affiliate_window/base.rb, line 60
def get_transaction(transaction_ids:)
  call(:get_transaction, aTransactionIds: transaction_ids)
end
get_transaction_list(merchant_ids: nil, start_date:, end_date:, date_type:, transaction_status: nil, limit: nil, offset: nil) click to toggle source

Gets the transactions that fall under the specified criteria wiki.affiliatewindow.com/index.php/AS:getTransactionList

# File lib/affiliate_window/base.rb, line 45
def get_transaction_list(merchant_ids: nil, start_date:, end_date:, date_type:, transaction_status: nil, limit: nil, offset: nil)
  call(
    :get_transaction_list,
    aMerchantIds: merchant_ids,
    dStartDate: start_date,
    dEndDate: end_date,
    sDateType: date_type,
    sTransactionStatus: transaction_status,
    iLimit: limit,
    iOffset: offset,
  )
end
get_transaction_product(transaction_ids:) click to toggle source

Gets products for the specified transaction # wiki.affiliatewindow.com/index.php/AS:getTransactionProduct

# File lib/affiliate_window/base.rb, line 39
def get_transaction_product(transaction_ids:)
  call(:get_transaction_product, aTransactionIds: transaction_ids)
end
get_transaction_queries(merchant_ids: nil, status: nil, click_refs:, offset: nil, limit: nil) click to toggle source

Gets the requested transaction queries wiki.affiliatewindow.com/index.php/AS:getTransactionQuerys

# File lib/affiliate_window/base.rb, line 78
def get_transaction_queries(merchant_ids: nil, status: nil, click_refs:, offset: nil, limit: nil)
  call(
    :get_transaction_queries,
    aMerchantIds: merchant_ids,
    aStatus: status,
    aClickRefs: click_refs,
    iOffset: offset,
    iLimit: limit,
  )
end

Private Instance Methods

call(method, params) click to toggle source
# File lib/affiliate_window/base.rb, line 125
def call(method, params)
  params = remove_nils(params)

  response = error_handler.handle do
    client.call(method, params, debug)
  end

  self.remaining_quota = parser.parse_quota(response)

  parser.parse(response, method)
end
remove_nils(params) click to toggle source
# File lib/affiliate_window/base.rb, line 137
def remove_nils(params)
  params.reject { |_, value| value.nil? }
end