Class: UltracartClient::AffiliateApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/api/affiliate_api.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ AffiliateApi

Returns a new instance of AffiliateApi.



19
20
21
# File 'lib/ultracart_api/api/affiliate_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ultracart_api/api/affiliate_api.rb', line 17

def api_client
  @api_client
end

Class Method Details

.new_using_api_key(simple_key, verify_ssl = true, debugging = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ultracart_api/api/affiliate_api.rb', line 23

def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
  api_config = Configuration.new
  api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
  api_config.api_version = '2017-03-01'
  api_config.verify_ssl = verify_ssl

  api_client = ApiClient.new(api_config)
  api_client.config.debugging = debugging

  UltracartClient::AffiliateApi.new(api_client)
end

Instance Method Details

#get_clicks_by_query(click_query, opts = {}) ⇒ AffiliateClicksResponse

Retrieve clicks Retrieves a group of clicks from the account based on a query object. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the clicks returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

Parameters:

  • click_query

    Click query

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Maximum 10000) (default to 10000)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_expand (String)

    The object expansion to perform on the result. Only option is link.

Returns:



43
44
45
46
# File 'lib/ultracart_api/api/affiliate_api.rb', line 43

def get_clicks_by_query(click_query, opts = {})
  data, _status_code, _headers = get_clicks_by_query_with_http_info(click_query, opts)
  data
end

#get_clicks_by_query_with_http_info(click_query, opts = {}) ⇒ Array<(AffiliateClicksResponse, Fixnum, Hash)>

Retrieve clicks Retrieves a group of clicks from the account based on a query object. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the clicks returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

Parameters:

  • click_query

    Click query

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Maximum 10000)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index.

  • :_expand (String)

    The object expansion to perform on the result. Only option is link.

Returns:

  • (Array<(AffiliateClicksResponse, Fixnum, Hash)>)

    AffiliateClicksResponse data, response status code and response headers



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ultracart_api/api/affiliate_api.rb', line 56

def get_clicks_by_query_with_http_info(click_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AffiliateApi.get_clicks_by_query ...'
  end
  # verify the required parameter 'click_query' is set
  if @api_client.config.client_side_validation && click_query.nil?
    fail ArgumentError, "Missing the required parameter 'click_query' when calling AffiliateApi.get_clicks_by_query"
  end
  # resource path
  local_var_path = '/affiliate/clicks/query'

  # query parameters
  query_params = {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(click_query)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'AffiliateClicksResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AffiliateApi#get_clicks_by_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ledgers_by_query(ledger_query, opts = {}) ⇒ AffiliateLedgersResponse

Retrieve ledger entries Retrieves a group of ledger entries from the account based on a query object. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the ledgers returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

Parameters:

  • ledger_query

    Ledger query

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Maximum 200) (default to 100)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_expand (String)

    The object expansion to perform on the result. Only option is link.

Returns:



107
108
109
110
# File 'lib/ultracart_api/api/affiliate_api.rb', line 107

def get_ledgers_by_query(ledger_query, opts = {})
  data, _status_code, _headers = get_ledgers_by_query_with_http_info(ledger_query, opts)
  data
end

#get_ledgers_by_query_with_http_info(ledger_query, opts = {}) ⇒ Array<(AffiliateLedgersResponse, Fixnum, Hash)>

Retrieve ledger entries Retrieves a group of ledger entries from the account based on a query object. If no parameters are specified, the API call will fail with a bad request error. Always specify some parameters to limit the scope of the ledgers returned to ones you are truly interested in. You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination.

Parameters:

  • ledger_query

    Ledger query

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :_limit (Integer)

    The maximum number of records to return on this one API call. (Maximum 200)

  • :_offset (Integer)

    Pagination of the record set. Offset is a zero based index.

  • :_expand (String)

    The object expansion to perform on the result. Only option is link.

Returns:

  • (Array<(AffiliateLedgersResponse, Fixnum, Hash)>)

    AffiliateLedgersResponse data, response status code and response headers



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/ultracart_api/api/affiliate_api.rb', line 120

def get_ledgers_by_query_with_http_info(ledger_query, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AffiliateApi.get_ledgers_by_query ...'
  end
  # verify the required parameter 'ledger_query' is set
  if @api_client.config.client_side_validation && ledger_query.nil?
    fail ArgumentError, "Missing the required parameter 'ledger_query' when calling AffiliateApi.get_ledgers_by_query"
  end
  # resource path
  local_var_path = '/affiliate/ledgers/query'

  # query parameters
  query_params = {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_expand'] = opts[:'_expand'] if !opts[:'_expand'].nil?

  # header parameters
  header_params = {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(ledger_query)
  auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'AffiliateLedgersResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: AffiliateApi#get_ledgers_by_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end