Class: Komoju::SubscriptionsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SubscriptionsApi

Returns a new instance of SubscriptionsApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_customer(create_customer_request, opts = {}) ⇒ Customer

Customer: Create Creates a new customer with the specified ‘payment_details`. Customer payment details are stored in a secure, PCI DSS-compliant way. Once you have a customer, you may specify the customer’s ‘id` instead of `payment_details` when creating a payment.

Parameters:

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

    the optional parameters

Returns:



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

def create_customer(create_customer_request, opts = {})
  data, _status_code, _headers = create_customer_with_http_info(create_customer_request, opts)
  data
end

#create_customer_with_http_info(create_customer_request, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

Customer: Create Creates a new customer with the specified &#x60;payment_details&#x60;. Customer payment details are stored in a secure, PCI DSS-compliant way. Once you have a customer, you may specify the customer&#39;s &#x60;id&#x60; instead of &#x60;payment_details&#x60; when creating a payment.

Parameters:

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



37
38
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
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 37

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

  # 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_customer_request)

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

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

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

#create_subscription(create_subscription_request, opts = {}) ⇒ Subscription

Subscription: Create Create a new subscription. A subscription represents a recurring payment. Recurring payments may be on a ‘weekly`, `monthly`, or `yearly` basis, specified by the period parameter. In order to create a subscription, a customer ID must be supplied. The customer object contains saved payment info, which is regularly charged by the subscription. A subscription can’t be modified once it’s created. To change a subscription, you must delete it and create a new one.

Parameters:

Returns:



95
96
97
98
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 95

def create_subscription(create_subscription_request, opts = {})
  data, _status_code, _headers = create_subscription_with_http_info(create_subscription_request, opts)
  data
end

#create_subscription_with_http_info(create_subscription_request, opts = {}) ⇒ Array<(Subscription, Integer, Hash)>

Subscription: Create Create a new subscription. A subscription represents a recurring payment. Recurring payments may be on a &#x60;weekly&#x60;, &#x60;monthly&#x60;, or &#x60;yearly&#x60; basis, specified by the period parameter. In order to create a subscription, a customer ID must be supplied. The customer object contains saved payment info, which is regularly charged by the subscription. A subscription can&#39;t be modified once it&#39;s created. To change a subscription, you must delete it and create a new one.

Parameters:

Returns:

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

    Subscription data, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 105

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

  # 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_subscription_request)

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

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

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

#delete_customer(id, opts = {}) ⇒ Customer

Customer: Destroy Deletes the customer with the given ‘id`. This complete erases the stored payment details from our database.

Parameters:

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

    the optional parameters

Returns:



163
164
165
166
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 163

def delete_customer(id, opts = {})
  data, _status_code, _headers = delete_customer_with_http_info(id, opts)
  data
end

#delete_customer_with_http_info(id, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

Customer: Destroy Deletes the customer with the given &#x60;id&#x60;. This complete erases the stored payment details from our database.

Parameters:

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 173

def delete_customer_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.delete_customer ...'
  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 SubscriptionsApi.delete_customer"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling SubscriptionsApi.delete_customer, 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 SubscriptionsApi.delete_customer, the character length must be great than or equal to 25.'
  end

  # resource path
  local_var_path = '/customers/{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] || 'Customer'

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

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

#delete_subscription(id, opts = {}) ⇒ Subscription

Subscription: Destroy Delete a subscription. Once deleted, the subscription’s regular payments will stop.

Parameters:

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

    the optional parameters

Returns:



234
235
236
237
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 234

def delete_subscription(id, opts = {})
  data, _status_code, _headers = delete_subscription_with_http_info(id, opts)
  data
end

#delete_subscription_with_http_info(id, opts = {}) ⇒ Array<(Subscription, Integer, Hash)>

Subscription: Destroy Delete a subscription. Once deleted, the subscription&#39;s regular payments will stop.

Parameters:

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

    the optional parameters

Returns:

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

    Subscription data, response status code and response headers



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
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
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 244

def delete_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.delete_subscription ...'
  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 SubscriptionsApi.delete_subscription"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling SubscriptionsApi.delete_subscription, 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 SubscriptionsApi.delete_subscription, the character length must be great than or equal to 25.'
  end

  # resource path
  local_var_path = '/subscriptions/{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] || 'Subscription'

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

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

#list_customers(opts = {}) ⇒ CustomerList

Customer: List Retrieves a paginated list of all previously-registered customers.

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.

  • :expiration (String)

    The expiration of the customer&#39;s credit card in MMYY format.

Returns:



309
310
311
312
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 309

def list_customers(opts = {})
  data, _status_code, _headers = list_customers_with_http_info(opts)
  data
end

#list_customers_with_http_info(opts = {}) ⇒ Array<(CustomerList, Integer, Hash)>

Customer: List Retrieves a paginated list of all previously-registered customers.

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.

  • :expiration (String)

    The expiration of the customer&#39;s credit card in MMYY format.

Returns:

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

    CustomerList data, response status code and response headers



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 323

def list_customers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.list_customers ...'
  end
  # resource path
  local_var_path = '/customers'

  # 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[:'expiration'] = opts[:'expiration'] if !opts[:'expiration'].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] || 'CustomerList'

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

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

#list_subscriptions(opts = {}) ⇒ SubscriptionList

Subscription: List List existing subscriptions.

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.

Returns:



380
381
382
383
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 380

def list_subscriptions(opts = {})
  data, _status_code, _headers = list_subscriptions_with_http_info(opts)
  data
end

#list_subscriptions_with_http_info(opts = {}) ⇒ Array<(SubscriptionList, Integer, Hash)>

Subscription: List List existing subscriptions.

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.

Returns:

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

    SubscriptionList data, response status code and response headers



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 393

def list_subscriptions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.list_subscriptions ...'
  end
  # resource path
  local_var_path = '/subscriptions'

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

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

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

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

#show_customer(id, opts = {}) ⇒ Customer

Customer: Show Retrieves customer personal information.

Parameters:

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

    the optional parameters

Returns:



446
447
448
449
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 446

def show_customer(id, opts = {})
  data, _status_code, _headers = show_customer_with_http_info(id, opts)
  data
end

#show_customer_with_http_info(id, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

Customer: Show Retrieves customer personal information.

Parameters:

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 456

def show_customer_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.show_customer ...'
  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 SubscriptionsApi.show_customer"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling SubscriptionsApi.show_customer, 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 SubscriptionsApi.show_customer, the character length must be great than or equal to 25.'
  end

  # resource path
  local_var_path = '/customers/{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] || 'Customer'

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

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

#show_subscription(id, opts = {}) ⇒ Subscription

Subscription: Show Show an existing subscription, including its customer and scrubbed payment details.

Parameters:

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

    the optional parameters

Returns:



517
518
519
520
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 517

def show_subscription(id, opts = {})
  data, _status_code, _headers = show_subscription_with_http_info(id, opts)
  data
end

#show_subscription_with_http_info(id, opts = {}) ⇒ Array<(Subscription, Integer, Hash)>

Subscription: Show Show an existing subscription, including its customer and scrubbed payment details.

Parameters:

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

    the optional parameters

Returns:

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

    Subscription data, response status code and response headers



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 527

def show_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.show_subscription ...'
  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 SubscriptionsApi.show_subscription"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling SubscriptionsApi.show_subscription, 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 SubscriptionsApi.show_subscription, the character length must be great than or equal to 25.'
  end

  # resource path
  local_var_path = '/subscriptions/{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] || 'Subscription'

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

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

#update_customer(id, update_customer_request, opts = {}) ⇒ Customer

Customer: Update Updates the customer with the given ‘id`. A new set of `payment_details` may be specified.

Parameters:

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

    the optional parameters

Returns:



589
590
591
592
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 589

def update_customer(id, update_customer_request, opts = {})
  data, _status_code, _headers = update_customer_with_http_info(id, update_customer_request, opts)
  data
end

#update_customer_with_http_info(id, update_customer_request, opts = {}) ⇒ Array<(Customer, Integer, Hash)>

Customer: Update Updates the customer with the given &#x60;id&#x60;. A new set of &#x60;payment_details&#x60; may be specified.

Parameters:

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

    the optional parameters

Returns:

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

    Customer data, response status code and response headers



600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
# File 'lib/komoju-sdk/api/subscriptions_api.rb', line 600

def update_customer_with_http_info(id, update_customer_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.update_customer ...'
  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 SubscriptionsApi.update_customer"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling SubscriptionsApi.update_customer, 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 SubscriptionsApi.update_customer, the character length must be great than or equal to 25.'
  end

  # verify the required parameter 'update_customer_request' is set
  if @api_client.config.client_side_validation && update_customer_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_customer_request' when calling SubscriptionsApi.update_customer"
  end
  # resource path
  local_var_path = '/customers/{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']
  # 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(update_customer_request)

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

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

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