Class: Brevo::TierApi

Inherits:
Object
  • Object
show all
Defined in:
lib/brevo/api/tier_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TierApi

Returns a new instance of TierApi.



19
20
21
# File 'lib/brevo/api/tier_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/brevo/api/tier_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_subscription_to_tier(pid, cid, tid, opts = {}) ⇒ TierForContact

Assign a tier Manually assigns a tier to a specific membership.

Parameters:

  • pid

    Loyalty Program ID

  • cid

    Contact ID

  • tid

    Tier ID

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/brevo/api/tier_api.rb', line 29

def add_subscription_to_tier(pid, cid, tid, opts = {})
  data, _status_code, _headers = add_subscription_to_tier_with_http_info(pid, cid, tid, opts)
  data
end

#add_subscription_to_tier_with_http_info(pid, cid, tid, opts = {}) ⇒ Array<(TierForContact, Fixnum, Hash)>

Assign a tier Manually assigns a tier to a specific membership.

Parameters:

  • pid

    Loyalty Program ID

  • cid

    Contact ID

  • tid

    Tier ID

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

    the optional parameters

Returns:

  • (Array<(TierForContact, Fixnum, Hash)>)

    TierForContact 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
# File 'lib/brevo/api/tier_api.rb', line 41

def add_subscription_to_tier_with_http_info(pid, cid, tid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.add_subscription_to_tier ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.add_subscription_to_tier"
  end
  # verify the required parameter 'cid' is set
  if @api_client.config.client_side_validation && cid.nil?
    fail ArgumentError, "Missing the required parameter 'cid' when calling TierApi.add_subscription_to_tier"
  end
  # verify the required parameter 'tid' is set
  if @api_client.config.client_side_validation && tid.nil?
    fail ArgumentError, "Missing the required parameter 'tid' when calling TierApi.add_subscription_to_tier"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/contacts/{cid}/tiers/{tid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'cid' + '}', cid.to_s).sub('{' + 'tid' + '}', tid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TierForContact')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#add_subscription_to_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tier_for_tier_group(pid, gid, payload, opts = {}) ⇒ Tier

Create a tier Creates a new tier in a loyalty program tier group. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Returns:



95
96
97
98
# File 'lib/brevo/api/tier_api.rb', line 95

def create_tier_for_tier_group(pid, gid, payload, opts = {})
  data, _status_code, _headers = create_tier_for_tier_group_with_http_info(pid, gid, payload, opts)
  data
end

#create_tier_for_tier_group_with_http_info(pid, gid, payload, opts = {}) ⇒ Array<(Tier, Fixnum, Hash)>

Create a tier Creates a new tier in a loyalty program tier group. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Returns:

  • (Array<(Tier, Fixnum, Hash)>)

    Tier data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/brevo/api/tier_api.rb', line 107

def create_tier_for_tier_group_with_http_info(pid, gid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.create_tier_for_tier_group ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.create_tier_for_tier_group"
  end
  # verify the required parameter 'gid' is set
  if @api_client.config.client_side_validation && gid.nil?
    fail ArgumentError, "Missing the required parameter 'gid' when calling TierApi.create_tier_for_tier_group"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling TierApi.create_tier_for_tier_group"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups/{gid}/tiers'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'gid' + '}', gid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payload)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Tier')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#create_tier_for_tier_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_tier_group(pid, payload, opts = {}) ⇒ TierGroup

Create a tier group Creates a new tier group in a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Tier group creation payload

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

    the optional parameters

Returns:



160
161
162
163
# File 'lib/brevo/api/tier_api.rb', line 160

def create_tier_group(pid, payload, opts = {})
  data, _status_code, _headers = create_tier_group_with_http_info(pid, payload, opts)
  data
end

#create_tier_group_with_http_info(pid, payload, opts = {}) ⇒ Array<(TierGroup, Fixnum, Hash)>

Create a tier group Creates a new tier group in a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Tier group creation payload

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

    the optional parameters

Returns:

  • (Array<(TierGroup, Fixnum, Hash)>)

    TierGroup data, response status code and response headers



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/brevo/api/tier_api.rb', line 171

def create_tier_group_with_http_info(pid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.create_tier_group ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.create_tier_group"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling TierApi.create_tier_group"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payload)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TierGroup')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#create_tier_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_tier(pid, tid, opts = {}) ⇒ String

Delete tier Deletes a tier from a loyalty program tier group. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Tier ID

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

    the optional parameters

Returns:

  • (String)


220
221
222
223
# File 'lib/brevo/api/tier_api.rb', line 220

def delete_tier(pid, tid, opts = {})
  data, _status_code, _headers = delete_tier_with_http_info(pid, tid, opts)
  data
end

#delete_tier_group(pid, gid, opts = {}) ⇒ String

Delete tier group Deletes a tier group from a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Returns:

  • (String)


280
281
282
283
# File 'lib/brevo/api/tier_api.rb', line 280

def delete_tier_group(pid, gid, opts = {})
  data, _status_code, _headers = delete_tier_group_with_http_info(pid, gid, opts)
  data
end

#delete_tier_group_with_http_info(pid, gid, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Delete tier group Deletes a tier group from a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/brevo/api/tier_api.rb', line 291

def delete_tier_group_with_http_info(pid, gid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.delete_tier_group ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.delete_tier_group"
  end
  # verify the required parameter 'gid' is set
  if @api_client.config.client_side_validation && gid.nil?
    fail ArgumentError, "Missing the required parameter 'gid' when calling TierApi.delete_tier_group"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups/{gid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'gid' + '}', gid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#delete_tier_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_tier_with_http_info(pid, tid, opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Delete tier Deletes a tier from a loyalty program tier group. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Tier ID

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

    the optional parameters

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# File 'lib/brevo/api/tier_api.rb', line 231

def delete_tier_with_http_info(pid, tid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.delete_tier ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.delete_tier"
  end
  # verify the required parameter 'tid' is set
  if @api_client.config.client_side_validation && tid.nil?
    fail ArgumentError, "Missing the required parameter 'tid' when calling TierApi.delete_tier"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tiers/{tid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'tid' + '}', tid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#delete_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_list_of_tier_groups(pid, opts = {}) ⇒ TierGroupPage

List tier groups Returns the list of tier groups defined within the loyalty program.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select &#39;active&#39; to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups. (default to draft)

Returns:



340
341
342
343
# File 'lib/brevo/api/tier_api.rb', line 340

def get_list_of_tier_groups(pid, opts = {})
  data, _status_code, _headers = get_list_of_tier_groups_with_http_info(pid, opts)
  data
end

#get_list_of_tier_groups_with_http_info(pid, opts = {}) ⇒ Array<(TierGroupPage, Fixnum, Hash)>

List tier groups Returns the list of tier groups defined within the loyalty program.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select &#39;active&#39; to retrieve list of all tier groups which are live for clients. Select draft to retrieve list of all non deleted tier groups.

Returns:

  • (Array<(TierGroupPage, Fixnum, Hash)>)

    TierGroupPage data, response status code and response headers



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/brevo/api/tier_api.rb', line 351

def get_list_of_tier_groups_with_http_info(pid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.get_list_of_tier_groups ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.get_list_of_tier_groups"
  end
  if @api_client.config.client_side_validation && opts[:'version'] && !['active', 'draft'].include?(opts[:'version'])
    fail ArgumentError, 'invalid value for "version", must be one of active, draft'
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups'.sub('{' + 'pid' + '}', pid.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TierGroupPage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#get_list_of_tier_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_loyalty_program_tier(pid, opts = {}) ⇒ LoyaltyTierPage

List tiers Returns the list of tiers defined within the loyalty program.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select &#39;active&#39; to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers. (default to draft)

Returns:



400
401
402
403
# File 'lib/brevo/api/tier_api.rb', line 400

def get_loyalty_program_tier(pid, opts = {})
  data, _status_code, _headers = get_loyalty_program_tier_with_http_info(pid, opts)
  data
end

#get_loyalty_program_tier_with_http_info(pid, opts = {}) ⇒ Array<(LoyaltyTierPage, Fixnum, Hash)>

List tiers Returns the list of tiers defined within the loyalty program.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select &#39;active&#39; to retrieve list of all tiers which are live for clients. Select draft to retrieve list of all non deleted tiers.

Returns:

  • (Array<(LoyaltyTierPage, Fixnum, Hash)>)

    LoyaltyTierPage data, response status code and response headers



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# File 'lib/brevo/api/tier_api.rb', line 411

def get_loyalty_program_tier_with_http_info(pid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.get_loyalty_program_tier ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.get_loyalty_program_tier"
  end
  if @api_client.config.client_side_validation && opts[:'version'] && !['active', 'draft'].include?(opts[:'version'])
    fail ArgumentError, 'invalid value for "version", must be one of active, draft'
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tiers'.sub('{' + 'pid' + '}', pid.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'LoyaltyTierPage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#get_loyalty_program_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_tier_group(pid, gid, opts = {}) ⇒ TierGroup

Get tier group Returns tier group information.

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group. (default to draft)

Returns:



461
462
463
464
# File 'lib/brevo/api/tier_api.rb', line 461

def get_tier_group(pid, gid, opts = {})
  data, _status_code, _headers = get_tier_group_with_http_info(pid, gid, opts)
  data
end

#get_tier_group_with_http_info(pid, gid, opts = {}) ⇒ Array<(TierGroup, Fixnum, Hash)>

Get tier group Returns tier group information.

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Select active to retrieve active version of tier group. Select draft to retrieve latest changes in tier group.

Returns:

  • (Array<(TierGroup, Fixnum, Hash)>)

    TierGroup data, response status code and response headers



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/brevo/api/tier_api.rb', line 473

def get_tier_group_with_http_info(pid, gid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.get_tier_group ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.get_tier_group"
  end
  # verify the required parameter 'gid' is set
  if @api_client.config.client_side_validation && gid.nil?
    fail ArgumentError, "Missing the required parameter 'gid' when calling TierApi.get_tier_group"
  end
  if @api_client.config.client_side_validation && opts[:'version'] && !['active', 'draft'].include?(opts[:'version'])
    fail ArgumentError, 'invalid value for "version", must be one of active, draft'
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups/{gid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'gid' + '}', gid.to_s)

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

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TierGroup')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#get_tier_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_tier(pid, tid, payload, opts = {}) ⇒ Tier

Update tier Modifies an existing tier for the specified tier group *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Tier ID

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

    the optional parameters

Returns:



527
528
529
530
# File 'lib/brevo/api/tier_api.rb', line 527

def update_tier(pid, tid, payload, opts = {})
  data, _status_code, _headers = update_tier_with_http_info(pid, tid, payload, opts)
  data
end

#update_tier_group(pid, gid, payload, opts = {}) ⇒ TierGroup

Update tier group Updates a tier group from a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

  • payload

    Tier group update payload

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

    the optional parameters

Returns:



593
594
595
596
# File 'lib/brevo/api/tier_api.rb', line 593

def update_tier_group(pid, gid, payload, opts = {})
  data, _status_code, _headers = update_tier_group_with_http_info(pid, gid, payload, opts)
  data
end

#update_tier_group_with_http_info(pid, gid, payload, opts = {}) ⇒ Array<(TierGroup, Fixnum, Hash)>

Update tier group Updates a tier group from a loyalty program. *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • gid

    Tier group ID

  • payload

    Tier group update payload

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

    the optional parameters

Returns:

  • (Array<(TierGroup, Fixnum, Hash)>)

    TierGroup data, response status code and response headers



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
# File 'lib/brevo/api/tier_api.rb', line 605

def update_tier_group_with_http_info(pid, gid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.update_tier_group ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.update_tier_group"
  end
  # verify the required parameter 'gid' is set
  if @api_client.config.client_side_validation && gid.nil?
    fail ArgumentError, "Missing the required parameter 'gid' when calling TierApi.update_tier_group"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling TierApi.update_tier_group"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tier-groups/{gid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'gid' + '}', gid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payload)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'TierGroup')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#update_tier_group\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_tier_with_http_info(pid, tid, payload, opts = {}) ⇒ Array<(Tier, Fixnum, Hash)>

Update tier Modifies an existing tier for the specified tier group *(The changes will take effect with the next publication of the loyalty program)*

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Tier ID

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

    the optional parameters

Returns:

  • (Array<(Tier, Fixnum, Hash)>)

    Tier data, response status code and response headers



539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
# File 'lib/brevo/api/tier_api.rb', line 539

def update_tier_with_http_info(pid, tid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TierApi.update_tier ...'
  end
  # verify the required parameter 'pid' is set
  if @api_client.config.client_side_validation && pid.nil?
    fail ArgumentError, "Missing the required parameter 'pid' when calling TierApi.update_tier"
  end
  # verify the required parameter 'tid' is set
  if @api_client.config.client_side_validation && tid.nil?
    fail ArgumentError, "Missing the required parameter 'tid' when calling TierApi.update_tier"
  end
  # verify the required parameter 'payload' is set
  if @api_client.config.client_side_validation && payload.nil?
    fail ArgumentError, "Missing the required parameter 'payload' when calling TierApi.update_tier"
  end
  # resource path
  local_var_path = '/loyalty/tier/programs/{pid}/tiers/{tid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'tid' + '}', tid.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(payload)
  auth_names = ['api-key', 'partner-key']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Tier')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TierApi#update_tier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end