Class: Conekta::SubscriptionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/conekta/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/conekta/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/conekta/api/subscriptions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_subscription(id, opts = {}) ⇒ SubscriptionResponse

Cancel Subscription You can cancel the subscription to stop the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



29
30
31
32
# File 'lib/conekta/api/subscriptions_api.rb', line 29

def cancel_subscription(id, opts = {})
  data, _status_code, _headers = cancel_subscription_with_http_info(id, opts)
  data
end

#cancel_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Cancel Subscription You can cancel the subscription to stop the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionResponse data, response status code and response headers



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
# File 'lib/conekta/api/subscriptions_api.rb', line 41

def cancel_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.cancel_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.cancel_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription/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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

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

#create_subscription(id, subscription_request, opts = {}) ⇒ SubscriptionResponse

Create Subscription You can create the subscription to include the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

  • subscription_request (SubscriptionRequest)

    requested field for subscriptions

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



103
104
105
106
# File 'lib/conekta/api/subscriptions_api.rb', line 103

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

#create_subscription_with_http_info(id, subscription_request, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Create Subscription You can create the subscription to include the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

  • subscription_request (SubscriptionRequest)

    requested field for subscriptions

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionResponse data, response status code and response headers



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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/conekta/api/subscriptions_api.rb', line 116

def create_subscription_with_http_info(id, subscription_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.create_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.create_subscription"
  end
  # verify the required parameter 'subscription_request' is set
  if @api_client.config.client_side_validation && subscription_request.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_request' when calling SubscriptionsApi.create_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription'.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/vnd.conekta-v2.1.0+json'])
  # 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
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

  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

#get_all_events_from_subscription(id, opts = {}) ⇒ SubscriptionEventsResponse

Get Events By Subscription You can get the events of the subscription(s) of a client, with the customer id

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



186
187
188
189
# File 'lib/conekta/api/subscriptions_api.rb', line 186

def get_all_events_from_subscription(id, opts = {})
  data, _status_code, _headers = get_all_events_from_subscription_with_http_info(id, opts)
  data
end

#get_all_events_from_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionEventsResponse, Integer, Hash)>

Get Events By Subscription You can get the events of the subscription(s) of a client, with the customer id

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionEventsResponse data, response status code and response headers



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
# File 'lib/conekta/api/subscriptions_api.rb', line 198

def get_all_events_from_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_all_events_from_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.get_all_events_from_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription/events'.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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

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

#get_subscription(id, opts = {}) ⇒ SubscriptionResponse

Get Subscription

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

Returns:



257
258
259
260
# File 'lib/conekta/api/subscriptions_api.rb', line 257

def get_subscription(id, opts = {})
  data, _status_code, _headers = get_subscription_with_http_info(id, opts)
  data
end

#get_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Get Subscription

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

Returns:

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

    SubscriptionResponse data, response status code and response headers



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
317
318
# File 'lib/conekta/api/subscriptions_api.rb', line 267

def get_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_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.get_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription'.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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?

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

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

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

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

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

#pause_subscription(id, opts = {}) ⇒ SubscriptionResponse

Pause Subscription You can pause the subscription to stop the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



327
328
329
330
# File 'lib/conekta/api/subscriptions_api.rb', line 327

def pause_subscription(id, opts = {})
  data, _status_code, _headers = pause_subscription_with_http_info(id, opts)
  data
end

#pause_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Pause Subscription You can pause the subscription to stop the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionResponse data, response status code and response headers



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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/conekta/api/subscriptions_api.rb', line 339

def pause_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.pause_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.pause_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription/pause'.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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

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

#resume_subscription(id, opts = {}) ⇒ SubscriptionResponse

Resume Subscription You can resume the subscription to start the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



400
401
402
403
# File 'lib/conekta/api/subscriptions_api.rb', line 400

def resume_subscription(id, opts = {})
  data, _status_code, _headers = resume_subscription_with_http_info(id, opts)
  data
end

#resume_subscription_with_http_info(id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Resume Subscription You can resume the subscription to start the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionResponse data, response status code and response headers



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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
# File 'lib/conekta/api/subscriptions_api.rb', line 412

def resume_subscription_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.resume_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.resume_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription/resume'.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/vnd.conekta-v2.1.0+json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

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

#update_subscription(id, subscription_update_request, opts = {}) ⇒ SubscriptionResponse

Update Subscription You can modify the subscription to change the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

  • subscription_update_request (SubscriptionUpdateRequest)

    requested field for update a subscription

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:



474
475
476
477
# File 'lib/conekta/api/subscriptions_api.rb', line 474

def update_subscription(id, subscription_update_request, opts = {})
  data, _status_code, _headers = update_subscription_with_http_info(id, subscription_update_request, opts)
  data
end

#update_subscription_with_http_info(id, subscription_update_request, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

Update Subscription You can modify the subscription to change the plans that your customers consume

Parameters:

  • id (String)

    Identifier of the resource

  • subscription_update_request (SubscriptionUpdateRequest)

    requested field for update a subscription

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    Use for knowing which language to use (default to ‘es’)

  • :x_child_company_id (String)

    In the case of a holding company, the company id of the child company to which will process the request.

Returns:

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

    SubscriptionResponse data, response status code and response headers



487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/conekta/api/subscriptions_api.rb', line 487

def update_subscription_with_http_info(id, subscription_update_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.update_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.update_subscription"
  end
  # verify the required parameter 'subscription_update_request' is set
  if @api_client.config.client_side_validation && subscription_update_request.nil?
    fail ArgumentError, "Missing the required parameter 'subscription_update_request' when calling SubscriptionsApi.update_subscription"
  end
  allowable_values = ["es", "en"]
  if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
    fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/customers/{id}/subscription'.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/vnd.conekta-v2.1.0+json'])
  # 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
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
  header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?

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

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

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

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

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