Class: Ifeelgoods::ClientsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ifeelgoods/api/clients_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ClientsApi

Returns a new instance of ClientsApi.



19
20
21
# File 'lib/ifeelgoods/api/clients_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/ifeelgoods/api/clients_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_client_budget_history(client_id, opts = {}) ⇒ GetClientBudgetHistory200Response

Get a Client budget history Use this function to retrieve detailed budget history about a client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20
  • :sort (String)
  • :type (String)

Returns:



31
32
33
34
# File 'lib/ifeelgoods/api/clients_api.rb', line 31

def get_client_budget_history(client_id, opts = {})
  data, _status_code, _headers = get_client_budget_history_with_http_info(client_id, opts)
  data
end

#get_client_budget_history_with_http_info(client_id, opts = {}) ⇒ Array<(GetClientBudgetHistory200Response, Integer, Hash)>

Get a Client budget history Use this function to retrieve detailed budget history about a client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20
  • :sort (String)
  • :type (String)

Returns:



45
46
47
48
49
50
51
52
53
54
55
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/ifeelgoods/api/clients_api.rb', line 45

def get_client_budget_history_with_http_info(client_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientsApi.get_client_budget_history ...'
  end
  # verify the required parameter 'client_id' is set
  if @api_client.config.client_side_validation && client_id.nil?
    fail ArgumentError, "Missing the required parameter 'client_id' when calling ClientsApi.get_client_budget_history"
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ClientsApi.get_client_budget_history, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ClientsApi.get_client_budget_history, must be smaller than or equal to 10000.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ClientsApi.get_client_budget_history, must be greater than or equal to 1.'
  end

  allowable_values = ["creation_datetime", "-creation_datetime"]
  if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
    fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
  end
  allowable_values = ["credit", "allocate", "deallocate", "debit"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/fulfillment/v2/clients/{client_id}/budget/history'.sub('{client_id}', CGI.escape(client_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetClientBudgetHistory200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']

  new_options = opts.merge(
    :operation => :"ClientsApi.get_client_budget_history",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientsApi#get_client_budget_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_client_by_id(client_id, opts = {}) ⇒ GetClientById200Response

Get a Client Use this function to retrieve detailed information about a client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Returns:



122
123
124
125
# File 'lib/ifeelgoods/api/clients_api.rb', line 122

def get_client_by_id(client_id, opts = {})
  data, _status_code, _headers = get_client_by_id_with_http_info(client_id, opts)
  data
end

#get_client_by_id_with_http_info(client_id, opts = {}) ⇒ Array<(GetClientById200Response, Integer, Hash)>

Get a Client Use this function to retrieve detailed information about a client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Returns:

  • (Array<(GetClientById200Response, Integer, Hash)>)

    GetClientById200Response data, response status code and response headers



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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/ifeelgoods/api/clients_api.rb', line 132

def get_client_by_id_with_http_info(client_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientsApi.get_client_by_id ...'
  end
  # verify the required parameter 'client_id' is set
  if @api_client.config.client_side_validation && client_id.nil?
    fail ArgumentError, "Missing the required parameter 'client_id' when calling ClientsApi.get_client_by_id"
  end
  # resource path
  local_var_path = '/fulfillment/v2/clients/{client_id}'.sub('{client_id}', CGI.escape(client_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetClientById200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']

  new_options = opts.merge(
    :operation => :"ClientsApi.get_client_by_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientsApi#get_client_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_client_discounts(client_id, opts = {}) ⇒ ListClientDiscounts200Response

List all discounts Use this function to list all the discounts of a specific client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Returns:



185
186
187
188
# File 'lib/ifeelgoods/api/clients_api.rb', line 185

def list_client_discounts(client_id, opts = {})
  data, _status_code, _headers = list_client_discounts_with_http_info(client_id, opts)
  data
end

#list_client_discounts_with_http_info(client_id, opts = {}) ⇒ Array<(ListClientDiscounts200Response, Integer, Hash)>

List all discounts Use this function to list all the discounts of a specific client

Parameters:

  • client_id (String)

    The client identifier

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

    the optional parameters

Returns:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/ifeelgoods/api/clients_api.rb', line 195

def list_client_discounts_with_http_info(client_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientsApi.list_client_discounts ...'
  end
  # verify the required parameter 'client_id' is set
  if @api_client.config.client_side_validation && client_id.nil?
    fail ArgumentError, "Missing the required parameter 'client_id' when calling ClientsApi.list_client_discounts"
  end
  # resource path
  local_var_path = '/fulfillment/v2/clients/{client_id}/discounts'.sub('{client_id}', CGI.escape(client_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListClientDiscounts200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']

  new_options = opts.merge(
    :operation => :"ClientsApi.list_client_discounts",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientsApi#list_client_discounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_clients(opts = {}) ⇒ ListClients200Response

List all Clients Use this function to list all the clients your account can manage

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20

Returns:



249
250
251
252
# File 'lib/ifeelgoods/api/clients_api.rb', line 249

def list_clients(opts = {})
  data, _status_code, _headers = list_clients_with_http_info(opts)
  data
end

#list_clients_with_http_info(opts = {}) ⇒ Array<(ListClients200Response, Integer, Hash)>

List all Clients Use this function to list all the clients your account can manage

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 20

Returns:

  • (Array<(ListClients200Response, Integer, Hash)>)

    ListClients200Response data, response status code and response headers



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/ifeelgoods/api/clients_api.rb', line 260

def list_clients_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ClientsApi.list_clients ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ClientsApi.list_clients, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ClientsApi.list_clients, must be smaller than or equal to 10000.'
  end

  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling ClientsApi.list_clients, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/fulfillment/v2/clients'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListClients200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key', 'bearer_auth', 'api_secret']

  new_options = opts.merge(
    :operation => :"ClientsApi.list_clients",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ClientsApi#list_clients\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end