Class: Brevo::RewardApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ RewardApi

Returns a new instance of RewardApi.



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

def api_client
  @api_client
end

Instance Method Details

#get_code_count(pid, cpid, opts = {}) ⇒ MainCodeCountHttpResponse

Get code count Get code count

Parameters:

  • pid

    Loyalty Program ID

  • cpid

    Code Pool ID

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/brevo/api/reward_api.rb', line 28

def get_code_count(pid, cpid, opts = {})
  data, _status_code, _headers = get_code_count_with_http_info(pid, cpid, opts)
  data
end

#get_code_count_with_http_info(pid, cpid, opts = {}) ⇒ Array<(MainCodeCountHttpResponse, Fixnum, Hash)>

Get code count Get code count

Parameters:

  • pid

    Loyalty Program ID

  • cpid

    Code Pool ID

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

    the optional parameters

Returns:

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

    MainCodeCountHttpResponse data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/brevo/api/reward_api.rb', line 39

def get_code_count_with_http_info(pid, cpid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.get_code_count ...'
  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 RewardApi.get_code_count"
  end
  # verify the required parameter 'cpid' is set
  if @api_client.config.client_side_validation && cpid.nil?
    fail ArgumentError, "Missing the required parameter 'cpid' when calling RewardApi.get_code_count"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/code-pools/{cpid}/codes-count'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'cpid' + '}', cpid.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(: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 => 'MainCodeCountHttpResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#get_code_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_offers_get(pid, opts = {}) ⇒ MainRewardPage

Get Reward Page API Returns a reward page

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (default to 25)

  • :offset (Integer)

    Pagination offset (default to 0)

  • :state (String)

    State of the reward (default to all)

  • :version (String)

    Version (default to draft)

Returns:



91
92
93
94
# File 'lib/brevo/api/reward_api.rb', line 91

def loyalty_offer_programs_pid_offers_get(pid, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_offers_get_with_http_info(pid, opts)
  data
end

#loyalty_offer_programs_pid_offers_get_with_http_info(pid, opts = {}) ⇒ Array<(MainRewardPage, Fixnum, Hash)>

Get Reward Page API Returns a reward page

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size

  • :offset (Integer)

    Pagination offset

  • :state (String)

    State of the reward

  • :version (String)

    Version

Returns:

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

    MainRewardPage data, response status code and response headers



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

def loyalty_offer_programs_pid_offers_get_with_http_info(pid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_offers_get ...'
  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 RewardApi.loyalty_offer_programs_pid_offers_get"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RewardApi.loyalty_offer_programs_pid_offers_get, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RewardApi.loyalty_offer_programs_pid_offers_get, must be greater than or equal to 1.'
  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/offer/programs/{pid}/offers'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
  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 => 'MainRewardPage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_offers_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_offers_post(pid, payload, opts = {}) ⇒ MainCreateRewardResponse

Create a reward Creates a new reward in loyalty program.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Reward creation payload

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

    the optional parameters

Returns:



165
166
167
168
# File 'lib/brevo/api/reward_api.rb', line 165

def loyalty_offer_programs_pid_offers_post(pid, payload, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_offers_post_with_http_info(pid, payload, opts)
  data
end

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

Create a reward Creates a new reward in loyalty program.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Reward creation payload

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

    the optional parameters

Returns:

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

    MainCreateRewardResponse data, response status code and response headers



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

def loyalty_offer_programs_pid_offers_post_with_http_info(pid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_offers_post ...'
  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 RewardApi.loyalty_offer_programs_pid_offers_post"
  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 RewardApi.loyalty_offer_programs_pid_offers_post"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/offers'.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 => 'MainCreateRewardResponse')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_offers_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_attribute_post(pid, payload, opts = {}) ⇒ MainRewardAttribution

Create a voucher Create a voucher and attribute it to a specific membership.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Voucher creation payload

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

    the optional parameters

Returns:



225
226
227
228
# File 'lib/brevo/api/reward_api.rb', line 225

def loyalty_offer_programs_pid_rewards_attribute_post(pid, payload, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_attribute_post_with_http_info(pid, payload, opts)
  data
end

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

Create a voucher Create a voucher and attribute it to a specific membership.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Voucher creation payload

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

    the optional parameters

Returns:

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

    MainRewardAttribution data, response status code and response headers



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
274
275
276
277
278
# File 'lib/brevo/api/reward_api.rb', line 236

def loyalty_offer_programs_pid_rewards_attribute_post_with_http_info(pid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_attribute_post ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_attribute_post"
  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 RewardApi.loyalty_offer_programs_pid_rewards_attribute_post"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/rewards/attribute'.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 => 'MainRewardAttribution')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_rewards_attribute_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_redeem_post(pid, payload, opts = {}) ⇒ MainRedeem

Create redeem voucher request Creates a request to redeem a voucher.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Redeem transaction creation payload

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

    the optional parameters

Returns:



285
286
287
288
# File 'lib/brevo/api/reward_api.rb', line 285

def loyalty_offer_programs_pid_rewards_redeem_post(pid, payload, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_redeem_post_with_http_info(pid, payload, opts)
  data
end

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

Create redeem voucher request Creates a request to redeem a voucher.

Parameters:

  • pid

    Loyalty Program ID

  • payload

    Redeem transaction creation payload

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

    the optional parameters

Returns:

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

    MainRedeem data, response status code and response headers



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
334
335
336
337
338
# File 'lib/brevo/api/reward_api.rb', line 296

def loyalty_offer_programs_pid_rewards_redeem_post_with_http_info(pid, payload, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_redeem_post ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_redeem_post"
  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 RewardApi.loyalty_offer_programs_pid_rewards_redeem_post"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/rewards/redeem'.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 => 'MainRedeem')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_rewards_redeem_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_redeem_tid_complete_post(pid, tid, opts = {}) ⇒ MainRedeem

Complete redeem voucher request Completes voucher redeem request.

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Redeem transaction ID

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

    the optional parameters

Returns:



345
346
347
348
# File 'lib/brevo/api/reward_api.rb', line 345

def loyalty_offer_programs_pid_rewards_redeem_tid_complete_post(pid, tid, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_redeem_tid_complete_post_with_http_info(pid, tid, opts)
  data
end

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

Complete redeem voucher request Completes voucher redeem request.

Parameters:

  • pid

    Loyalty Program ID

  • tid

    Redeem transaction ID

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

    the optional parameters

Returns:

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

    MainRedeem data, response status code and response headers



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/brevo/api/reward_api.rb', line 356

def loyalty_offer_programs_pid_rewards_redeem_tid_complete_post_with_http_info(pid, tid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_redeem_tid_complete_post ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_redeem_tid_complete_post"
  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 RewardApi.loyalty_offer_programs_pid_rewards_redeem_tid_complete_post"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/rewards/redeem/{tid}/complete'.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(: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 => 'MainRedeem')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_rewards_redeem_tid_complete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_revoke_delete(pid, opts = {}) ⇒ String

Revoke vouchers Revoke attributed vouchers.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :attributed_reward_ids (String)

    Reward Attribution IDs (comma seperated)

Returns:

  • (String)


405
406
407
408
# File 'lib/brevo/api/reward_api.rb', line 405

def loyalty_offer_programs_pid_rewards_revoke_delete(pid, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_revoke_delete_with_http_info(pid, opts)
  data
end

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

Revoke vouchers Revoke attributed vouchers.

Parameters:

  • pid

    Loyalty Program ID

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

    the optional parameters

Options Hash (opts):

  • :attributed_reward_ids (String)

    Reward Attribution IDs (comma seperated)

Returns:

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

    String data, response status code and response headers



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
# File 'lib/brevo/api/reward_api.rb', line 416

def loyalty_offer_programs_pid_rewards_revoke_delete_with_http_info(pid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_revoke_delete ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_revoke_delete"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/rewards/revoke'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}
  query_params[:'attributedRewardIds'] = opts[:'attributed_reward_ids'] if !opts[:'attributed_reward_ids'].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(: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: RewardApi#loyalty_offer_programs_pid_rewards_revoke_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_rid_get(pid, rid, opts = {}) ⇒ MainReward

Get reward information Returns reward information.

Parameters:

  • pid

    Loyalty Program ID

  • rid

    Reward ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Version (default to draft)

Returns:



463
464
465
466
# File 'lib/brevo/api/reward_api.rb', line 463

def loyalty_offer_programs_pid_rewards_rid_get(pid, rid, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_rid_get_with_http_info(pid, rid, opts)
  data
end

#loyalty_offer_programs_pid_rewards_rid_get_with_http_info(pid, rid, opts = {}) ⇒ Array<(MainReward, Fixnum, Hash)>

Get reward information Returns reward information.

Parameters:

  • pid

    Loyalty Program ID

  • rid

    Reward ID

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

    the optional parameters

Options Hash (opts):

  • :version (String)

    Version

Returns:

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

    MainReward data, response status code and response headers



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
520
521
# File 'lib/brevo/api/reward_api.rb', line 475

def loyalty_offer_programs_pid_rewards_rid_get_with_http_info(pid, rid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_rid_get ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_rid_get"
  end
  # verify the required parameter 'rid' is set
  if @api_client.config.client_side_validation && rid.nil?
    fail ArgumentError, "Missing the required parameter 'rid' when calling RewardApi.loyalty_offer_programs_pid_rewards_rid_get"
  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/offer/programs/{pid}/rewards/{rid}'.sub('{' + 'pid' + '}', pid.to_s).sub('{' + 'rid' + '}', rid.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 => 'MainReward')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_rewards_rid_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_rewards_validate_post(pid, body, opts = {}) ⇒ MainRewardValidate

Validate a reward Validates a reward.

Parameters:

  • pid

    Loyalty Program ID

  • body

    Reward validation payload

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

    the optional parameters

Returns:



528
529
530
531
# File 'lib/brevo/api/reward_api.rb', line 528

def loyalty_offer_programs_pid_rewards_validate_post(pid, body, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_rewards_validate_post_with_http_info(pid, body, opts)
  data
end

#loyalty_offer_programs_pid_rewards_validate_post_with_http_info(pid, body, opts = {}) ⇒ Array<(MainRewardValidate, Fixnum, Hash)>

Validate a reward Validates a reward.

Parameters:

  • pid

    Loyalty Program ID

  • body

    Reward validation payload

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

    the optional parameters

Returns:

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

    MainRewardValidate 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
# File 'lib/brevo/api/reward_api.rb', line 539

def loyalty_offer_programs_pid_rewards_validate_post_with_http_info(pid, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_rewards_validate_post ...'
  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 RewardApi.loyalty_offer_programs_pid_rewards_validate_post"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling RewardApi.loyalty_offer_programs_pid_rewards_validate_post"
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/rewards/validate'.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(body)
  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 => 'MainRewardValidate')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_rewards_validate_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#loyalty_offer_programs_pid_vouchers_get(pid, contact_id, opts = {}) ⇒ MainModelContactRewardsResp

Get voucher for a contact Get voucher for a contact

Parameters:

  • pid

    Loyalty Program ID

  • contact_id

    Contact ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size (default to 25)

  • :offset (Integer)

    Pagination offset (default to 0)

  • :sort (String)

    Sort order (default to desc)

  • :sort_field (String)

    Sort field (default to updatedAt)

  • :metadata_key_value (String)

    Metadata value for a Key filter

  • :reward_id (String)

    Reward ID

Returns:



594
595
596
597
# File 'lib/brevo/api/reward_api.rb', line 594

def loyalty_offer_programs_pid_vouchers_get(pid, contact_id, opts = {})
  data, _status_code, _headers = loyalty_offer_programs_pid_vouchers_get_with_http_info(pid, contact_id, opts)
  data
end

#loyalty_offer_programs_pid_vouchers_get_with_http_info(pid, contact_id, opts = {}) ⇒ Array<(MainModelContactRewardsResp, Fixnum, Hash)>

Get voucher for a contact Get voucher for a contact

Parameters:

  • pid

    Loyalty Program ID

  • contact_id

    Contact ID

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Page size

  • :offset (Integer)

    Pagination offset

  • :sort (String)

    Sort order

  • :sort_field (String)

    Sort field

  • :metadata_key_value (String)

    Metadata value for a Key filter

  • :reward_id (String)

    Reward ID

Returns:



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/brevo/api/reward_api.rb', line 611

def loyalty_offer_programs_pid_vouchers_get_with_http_info(pid, contact_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RewardApi.loyalty_offer_programs_pid_vouchers_get ...'
  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 RewardApi.loyalty_offer_programs_pid_vouchers_get"
  end
  # verify the required parameter 'contact_id' is set
  if @api_client.config.client_side_validation && contact_id.nil?
    fail ArgumentError, "Missing the required parameter 'contact_id' when calling RewardApi.loyalty_offer_programs_pid_vouchers_get"
  end
  if @api_client.config.client_side_validation && contact_id < 1
    fail ArgumentError, 'invalid value for "contact_id" when calling RewardApi.loyalty_offer_programs_pid_vouchers_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling RewardApi.loyalty_offer_programs_pid_vouchers_get, must be smaller than or equal to 100.'
  end

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

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

  if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])
    fail ArgumentError, 'invalid value for "sort", must be one of asc, desc'
  end
  if @api_client.config.client_side_validation && opts[:'sort_field'] && !['updatedAt', 'createdAt'].include?(opts[:'sort_field'])
    fail ArgumentError, 'invalid value for "sort_field", must be one of updatedAt, createdAt'
  end
  # resource path
  local_var_path = '/loyalty/offer/programs/{pid}/vouchers'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}
  query_params[:'contactId'] = contact_id
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'metadata[key][value]'] = opts[:'metadata_key_value'] if !opts[:'metadata_key_value'].nil?
  query_params[:'rewardId'] = opts[:'reward_id'] if !opts[:'reward_id'].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 => 'MainModelContactRewardsResp')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RewardApi#loyalty_offer_programs_pid_vouchers_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end