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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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.2.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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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.2.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_subscription(id, opts = {}) ⇒ SubscriptionResponse

Get Subscription [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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:



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

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

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

Get Subscription Events [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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:



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

def get_subscription_events(id, opts = {})
  data, _status_code, _headers = get_subscription_events_with_http_info(id, opts)
  data
end

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

Get Subscription Events [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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



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

def get_subscription_events_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.get_subscription_events ...'
  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_events"
  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.2.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_subscription_events",
    :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_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Get Subscription [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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



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

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.2.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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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:



329
330
331
332
# File 'lib/conekta/api/subscriptions_api.rb', line 329

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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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



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

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.2.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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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:



402
403
404
405
# File 'lib/conekta/api/subscriptions_api.rb', line 402

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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0.

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



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

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.2.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

#subscription_cancel(customer_id, id, opts = {}) ⇒ SubscriptionResponse

Cancel Subscription Cancel a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



476
477
478
479
# File 'lib/conekta/api/subscriptions_api.rb', line 476

def subscription_cancel(customer_id, id, opts = {})
  data, _status_code, _headers = subscription_cancel_with_http_info(customer_id, id, opts)
  data
end

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

Cancel Subscription Cancel a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



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

def subscription_cancel_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_cancel ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_cancel"
  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.subscription_cancel"
  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/{customer_id}/subscriptions/{id}/cancel'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscription_cancel",
    :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#subscription_cancel\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscription_create(customer_id, subscription_request, opts = {}) ⇒ SubscriptionResponse

Create Subscription Create a new subscription for a customer (keeps existing subscriptions active)

Parameters:

  • customer_id (String)

    Identifier of the customer 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:



555
556
557
558
# File 'lib/conekta/api/subscriptions_api.rb', line 555

def subscription_create(customer_id, subscription_request, opts = {})
  data, _status_code, _headers = subscription_create_with_http_info(customer_id, subscription_request, opts)
  data
end

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

Create Subscription Create a new subscription for a customer (keeps existing subscriptions active)

Parameters:

  • customer_id (String)

    Identifier of the customer 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



568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
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
# File 'lib/conekta/api/subscriptions_api.rb', line 568

def subscription_create_with_http_info(customer_id, subscription_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_create ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_create"
  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.subscription_create"
  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/{customer_id}/subscriptions'.sub('{' + 'customer_id' + '}', CGI.escape(customer_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.2.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.subscription_create",
    :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#subscription_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscription_events(customer_id, id, opts = {}) ⇒ SubscriptionEventsResponse

Get Subscription Events Get events for a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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.

  • :limit (Integer)

    The numbers of items to return, the maximum value is 250 (default to 20)

  • :search (String)

    General order search, e.g. by mail, reference etc.

  • :_next (String)

    next page

  • :previous (String)

    previous page

Returns:



643
644
645
646
# File 'lib/conekta/api/subscriptions_api.rb', line 643

def subscription_events(customer_id, id, opts = {})
  data, _status_code, _headers = subscription_events_with_http_info(customer_id, id, opts)
  data
end

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

Get Subscription Events Get events for a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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.

  • :limit (Integer)

    The numbers of items to return, the maximum value is 250 (default to 20)

  • :search (String)

    General order search, e.g. by mail, reference etc.

  • :_next (String)

    next page

  • :previous (String)

    previous page

Returns:

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

    SubscriptionEventsResponse data, response status code and response headers



660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
# File 'lib/conekta/api/subscriptions_api.rb', line 660

def subscription_events_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_events ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_events"
  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.subscription_events"
  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
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SubscriptionsApi.subscription_events, must be smaller than or equal to 250.'
  end

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

  # resource path
  local_var_path = '/customers/{customer_id}/subscriptions/{id}/events'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
  query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.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.subscription_events",
    :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#subscription_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscription_list(customer_id, opts = {}) ⇒ SubscriptionResponse

List Subscriptions Get a list of subscriptions for a customer

Parameters:

  • customer_id (String)

    Identifier of the customer 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.

  • :limit (Integer)

    The numbers of items to return, the maximum value is 250 (default to 20)

  • :search (String)

    General order search, e.g. by mail, reference etc.

  • :_next (String)

    next page

  • :previous (String)

    previous page

Returns:



741
742
743
744
# File 'lib/conekta/api/subscriptions_api.rb', line 741

def subscription_list(customer_id, opts = {})
  data, _status_code, _headers = subscription_list_with_http_info(customer_id, opts)
  data
end

#subscription_list_with_http_info(customer_id, opts = {}) ⇒ Array<(SubscriptionResponse, Integer, Hash)>

List Subscriptions Get a list of subscriptions for a customer

Parameters:

  • customer_id (String)

    Identifier of the customer 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.

  • :limit (Integer)

    The numbers of items to return, the maximum value is 250 (default to 20)

  • :search (String)

    General order search, e.g. by mail, reference etc.

  • :_next (String)

    next page

  • :previous (String)

    previous page

Returns:

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

    SubscriptionResponse data, response status code and response headers



757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
# File 'lib/conekta/api/subscriptions_api.rb', line 757

def subscription_list_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_list ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_list"
  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
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SubscriptionsApi.subscription_list, must be smaller than or equal to 250.'
  end

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

  # resource path
  local_var_path = '/customers/{customer_id}/subscriptions'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?
  query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.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.subscription_list",
    :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#subscription_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscription_pause(customer_id, id, opts = {}) ⇒ SubscriptionResponse

Pause Subscription Pause a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



831
832
833
834
# File 'lib/conekta/api/subscriptions_api.rb', line 831

def subscription_pause(customer_id, id, opts = {})
  data, _status_code, _headers = subscription_pause_with_http_info(customer_id, id, opts)
  data
end

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

Pause Subscription Pause a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
# File 'lib/conekta/api/subscriptions_api.rb', line 844

def subscription_pause_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_pause ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_pause"
  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.subscription_pause"
  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/{customer_id}/subscriptions/{id}/pause'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscription_pause",
    :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#subscription_pause\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscription_resume(customer_id, id, opts = {}) ⇒ SubscriptionResponse

Resume Subscription Resume a specific paused subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



910
911
912
913
# File 'lib/conekta/api/subscriptions_api.rb', line 910

def subscription_resume(customer_id, id, opts = {})
  data, _status_code, _headers = subscription_resume_with_http_info(customer_id, id, opts)
  data
end

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

Resume Subscription Resume a specific paused subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
# File 'lib/conekta/api/subscriptions_api.rb', line 923

def subscription_resume_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_resume ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_resume"
  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.subscription_resume"
  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/{customer_id}/subscriptions/{id}/resume'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscription_resume",
    :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#subscription_resume\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Update Subscription Update a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



990
991
992
993
# File 'lib/conekta/api/subscriptions_api.rb', line 990

def subscription_update(customer_id, id, subscription_update_request, opts = {})
  data, _status_code, _headers = subscription_update_with_http_info(customer_id, id, subscription_update_request, opts)
  data
end

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

Update Subscription Update a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
# File 'lib/conekta/api/subscriptions_api.rb', line 1004

def subscription_update_with_http_info(customer_id, id, subscription_update_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscription_update ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscription_update"
  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.subscription_update"
  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.subscription_update"
  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/{customer_id}/subscriptions/{id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscription_update",
    :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#subscription_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscriptions_get(customer_id, id, opts = {}) ⇒ SubscriptionResponse

Get Subscription Retrieve a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



1079
1080
1081
1082
# File 'lib/conekta/api/subscriptions_api.rb', line 1079

def subscriptions_get(customer_id, id, opts = {})
  data, _status_code, _headers = subscriptions_get_with_http_info(customer_id, id, opts)
  data
end

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

Get Subscription Retrieve a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
# File 'lib/conekta/api/subscriptions_api.rb', line 1092

def subscriptions_get_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_get ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscriptions_get"
  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.subscriptions_get"
  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/{customer_id}/subscriptions/{id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscriptions_get",
    :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#subscriptions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscriptions_retry(customer_id, id, opts = {}) ⇒ SubscriptionResponse

Retry Failed Payment Retry a failed payment for a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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:



1158
1159
1160
1161
# File 'lib/conekta/api/subscriptions_api.rb', line 1158

def subscriptions_retry(customer_id, id, opts = {})
  data, _status_code, _headers = subscriptions_retry_with_http_info(customer_id, id, opts)
  data
end

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

Retry Failed Payment Retry a failed payment for a specific subscription

Parameters:

  • customer_id (String)

    Identifier of the customer resource

  • id (String)

    Identifier of the subscription 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



1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
# File 'lib/conekta/api/subscriptions_api.rb', line 1171

def subscriptions_retry_with_http_info(customer_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SubscriptionsApi.subscriptions_retry ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling SubscriptionsApi.subscriptions_retry"
  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.subscriptions_retry"
  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/{customer_id}/subscriptions/{id}/retry'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)).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.2.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.subscriptions_retry",
    :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#subscriptions_retry\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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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:



1237
1238
1239
1240
# File 'lib/conekta/api/subscriptions_api.rb', line 1237

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 [Deprecated] DEPRECATED: This endpoint will be removed in version 2.3.0. 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



1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
# File 'lib/conekta/api/subscriptions_api.rb', line 1250

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.2.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