Sha256: b63a9b5cfc7788636bc1e4150685d6e7e4c918046ac7ee147ec9a5e8dd80d21b

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

module SoapyCake
  class Affiliate
    attr_reader :api_key, :affiliate_id

    def initialize(opts = {})
      @api_key = opts[:api_key]
      @affiliate_id = opts[:affiliate_id]
    end

    def bills(opts = {})
      cake_client(:reports, :bills, opts)
    end

    def offer_feed(opts = {})
      cake_client(:offers, :offer_feed, opts)
    end

    def campaign(opts = {})
      cake_client(:offers, :get_campaign, opts)
    end

    private

    def cake_client(api, method, opts = {})
      Client::CakeClient.send(api, role: :affiliates)
        .send(method, opts.merge(affiliate_id: affiliate_id, api_key: api_key))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soapy_cake-0.3.4 lib/soapy_cake/affiliate.rb
soapy_cake-0.3.3 lib/soapy_cake/affiliate.rb
soapy_cake-0.3.2 lib/soapy_cake/affiliate.rb
soapy_cake-0.3.1 lib/soapy_cake/affiliate.rb