Class: Komoju::DisbursementsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/komoju-sdk/api/disbursements_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DisbursementsApi

Returns a new instance of DisbursementsApi.



19
20
21
# File 'lib/komoju-sdk/api/disbursements_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/komoju-sdk/api/disbursements_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_disbursement(id, cancel_disbursement_request, opts = {}) ⇒ Disbursement

Disbursement: Cancel Cancels a disbursement.

Parameters:

  • id (String)
  • cancel_disbursement_request (CancelDisbursementRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 28

def cancel_disbursement(id, cancel_disbursement_request, opts = {})
  data, _status_code, _headers = cancel_disbursement_with_http_info(id, cancel_disbursement_request, opts)
  data
end

#cancel_disbursement_with_http_info(id, cancel_disbursement_request, opts = {}) ⇒ Array<(Disbursement, Integer, Hash)>

Disbursement: Cancel Cancels a disbursement.

Parameters:

  • id (String)
  • cancel_disbursement_request (CancelDisbursementRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    Disbursement data, response status code and response headers



39
40
41
42
43
44
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
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 39

def cancel_disbursement_with_http_info(id, cancel_disbursement_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.cancel_disbursement ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling DisbursementsApi.cancel_disbursement"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling DisbursementsApi.cancel_disbursement, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 25
    fail ArgumentError, 'invalid value for "id" when calling DisbursementsApi.cancel_disbursement, the character length must be great than or equal to 25.'
  end

  # verify the required parameter 'cancel_disbursement_request' is set
  if @api_client.config.client_side_validation && cancel_disbursement_request.nil?
    fail ArgumentError, "Missing the required parameter 'cancel_disbursement_request' when calling DisbursementsApi.cancel_disbursement"
  end
  # resource path
  local_var_path = '/disbursements/{id}/cancel'.sub('{' + 'id' + '}', CGI.escape(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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(cancel_disbursement_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"DisbursementsApi.cancel_disbursement",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DisbursementsApi#cancel_disbursement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_disbursement(create_disbursement_request, opts = {}) ⇒ Disbursement

Disbursement: Create Creates a new disbursement.

Parameters:

Returns:



109
110
111
112
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 109

def create_disbursement(create_disbursement_request, opts = {})
  data, _status_code, _headers = create_disbursement_with_http_info(create_disbursement_request, opts)
  data
end

#create_disbursement_with_http_info(create_disbursement_request, opts = {}) ⇒ Array<(Disbursement, Integer, Hash)>

Disbursement: Create Creates a new disbursement.

Parameters:

Returns:

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

    Disbursement data, response status code and response headers



119
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
163
164
165
166
167
168
169
170
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 119

def create_disbursement_with_http_info(create_disbursement_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.create_disbursement ...'
  end
  # verify the required parameter 'create_disbursement_request' is set
  if @api_client.config.client_side_validation && create_disbursement_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_disbursement_request' when calling DisbursementsApi.create_disbursement"
  end
  # resource path
  local_var_path = '/disbursements'

  # 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']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_disbursement_request)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"DisbursementsApi.create_disbursement",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DisbursementsApi#create_disbursement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#disbursement_report(start_time, end_time, currency, status, opts = {}) ⇒ nil

Disbursement: Report View disbursements in CSV format.

Parameters:

  • start_time (Time)
  • end_time (Time)
  • currency (Currency)
  • status (DisbursementStatus)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


180
181
182
183
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 180

def disbursement_report(start_time, end_time, currency, status, opts = {})
  disbursement_report_with_http_info(start_time, end_time, currency, status, opts)
  nil
end

#disbursement_report_with_http_info(start_time, end_time, currency, status, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Disbursement: Report View disbursements in CSV format.

Parameters:

  • start_time (Time)
  • end_time (Time)
  • currency (Currency)
  • status (DisbursementStatus)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



193
194
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 193

def disbursement_report_with_http_info(start_time, end_time, currency, status, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.disbursement_report ...'
  end
  # verify the required parameter 'start_time' is set
  if @api_client.config.client_side_validation && start_time.nil?
    fail ArgumentError, "Missing the required parameter 'start_time' when calling DisbursementsApi.disbursement_report"
  end
  # verify the required parameter 'end_time' is set
  if @api_client.config.client_side_validation && end_time.nil?
    fail ArgumentError, "Missing the required parameter 'end_time' when calling DisbursementsApi.disbursement_report"
  end
  # verify the required parameter 'currency' is set
  if @api_client.config.client_side_validation && currency.nil?
    fail ArgumentError, "Missing the required parameter 'currency' when calling DisbursementsApi.disbursement_report"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling DisbursementsApi.disbursement_report"
  end
  # resource path
  local_var_path = '/disbursements/report'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_time'] = start_time
  query_params[:'end_time'] = end_time
  query_params[:'currency'] = currency
  query_params[:'status'] = status

  # 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]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"DisbursementsApi.disbursement_report",
    :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: DisbursementsApi#disbursement_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_disbursements(opts = {}) ⇒ DisbursementList

Disbursement: List Lists disbursements.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_time (Time)

    Query for records created after this time.

  • :end_time (Time)

    Query for records created before this time.

  • :per_page (Integer)

    How many objects per page.

  • :page (Integer)

    Page number to query for.

  • :currency (Currency)

Returns:



266
267
268
269
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 266

def list_disbursements(opts = {})
  data, _status_code, _headers = list_disbursements_with_http_info(opts)
  data
end

#list_disbursements_with_http_info(opts = {}) ⇒ Array<(DisbursementList, Integer, Hash)>

Disbursement: List Lists disbursements.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_time (Time)

    Query for records created after this time.

  • :end_time (Time)

    Query for records created before this time.

  • :per_page (Integer)

    How many objects per page.

  • :page (Integer)

    Page number to query for.

  • :currency (Currency)

Returns:

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

    DisbursementList data, response status code and response headers



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
317
318
319
320
321
322
323
324
325
326
327
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 280

def list_disbursements_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.list_disbursements ...'
  end
  # resource path
  local_var_path = '/disbursements'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].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] || 'DisbursementList'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"DisbursementsApi.list_disbursements",
    :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: DisbursementsApi#list_disbursements\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#show_disbursement(id, opts = {}) ⇒ Disbursement

Disbursement: Show Retrieves a disbursement.

Parameters:

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

    the optional parameters

Returns:



334
335
336
337
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 334

def show_disbursement(id, opts = {})
  data, _status_code, _headers = show_disbursement_with_http_info(id, opts)
  data
end

#show_disbursement_with_http_info(id, opts = {}) ⇒ Array<(Disbursement, Integer, Hash)>

Disbursement: Show Retrieves a disbursement.

Parameters:

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

    the optional parameters

Returns:

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

    Disbursement data, response status code and response headers



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/komoju-sdk/api/disbursements_api.rb', line 344

def show_disbursement_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DisbursementsApi.show_disbursement ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling DisbursementsApi.show_disbursement"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling DisbursementsApi.show_disbursement, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 25
    fail ArgumentError, 'invalid value for "id" when calling DisbursementsApi.show_disbursement, the character length must be great than or equal to 25.'
  end

  # resource path
  local_var_path = '/disbursements/{id}'.sub('{' + 'id' + '}', CGI.escape(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] || 'Disbursement'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"DisbursementsApi.show_disbursement",
    :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: DisbursementsApi#show_disbursement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end