Class: Brevo::ProgramApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ProgramApi

Returns a new instance of ProgramApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_new_lp(body, opts = {}) ⇒ LoyaltyProgram

Create loyalty program Creates loyalty program

Parameters:

  • body

    Create Loyalty Program Payload

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/brevo/api/program_api.rb', line 27

def create_new_lp(body, opts = {})
  data, _status_code, _headers = create_new_lp_with_http_info(body, opts)
  data
end

#create_new_lp_with_http_info(body, opts = {}) ⇒ Array<(LoyaltyProgram, Fixnum, Hash)>

Create loyalty program Creates loyalty program

Parameters:

  • body

    Create Loyalty Program Payload

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

    the optional parameters

Returns:

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

    LoyaltyProgram data, response status code and response headers



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

def create_new_lp_with_http_info(body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.create_new_lp ...'
  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 ProgramApi.create_new_lp"
  end
  # resource path
  local_var_path = '/loyalty/config/programs'

  # 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 => 'LoyaltyProgram')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#create_new_lp\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_contact_members(pid, member_contact_ids, opts = {}) ⇒ nil

Delete subscription member Deletes member from a subscription

Parameters:

  • pid

    Loyalty Program Id

  • member_contact_ids

    Member Contact Ids

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

    the optional parameters

Returns:

  • (nil)


82
83
84
85
# File 'lib/brevo/api/program_api.rb', line 82

def delete_contact_members(pid, member_contact_ids, opts = {})
  delete_contact_members_with_http_info(pid, member_contact_ids, opts)
  nil
end

#delete_contact_members_with_http_info(pid, member_contact_ids, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete subscription member Deletes member from a subscription

Parameters:

  • pid

    Loyalty Program Id

  • member_contact_ids

    Member Contact Ids

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



93
94
95
96
97
98
99
100
101
102
103
104
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
# File 'lib/brevo/api/program_api.rb', line 93

def delete_contact_members_with_http_info(pid, member_contact_ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.delete_contact_members ...'
  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 ProgramApi.delete_contact_members"
  end
  # verify the required parameter 'member_contact_ids' is set
  if @api_client.config.client_side_validation && member_contact_ids.nil?
    fail ArgumentError, "Missing the required parameter 'member_contact_ids' when calling ProgramApi.delete_contact_members"
  end
  # resource path
  local_var_path = '/loyalty/config/programs/{pid}/subscription-members'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}
  query_params[:'memberContactIds'] = member_contact_ids

  # 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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#delete_contact_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_loyalty_program(pid, opts = {}) ⇒ nil

Delete Loyalty Program Deletes Loyalty Program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:

  • (nil)


141
142
143
144
# File 'lib/brevo/api/program_api.rb', line 141

def delete_loyalty_program(pid, opts = {})
  delete_loyalty_program_with_http_info(pid, opts)
  nil
end

#delete_loyalty_program_with_http_info(pid, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete Loyalty Program Deletes Loyalty Program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/brevo/api/program_api.rb', line 151

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

#get_loyalty_program_info(pid, opts = {}) ⇒ LoyaltyProgram

Get loyalty program Info Returns loyalty program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:



194
195
196
197
# File 'lib/brevo/api/program_api.rb', line 194

def get_loyalty_program_info(pid, opts = {})
  data, _status_code, _headers = get_loyalty_program_info_with_http_info(pid, opts)
  data
end

#get_loyalty_program_info_with_http_info(pid, opts = {}) ⇒ Array<(LoyaltyProgram, Fixnum, Hash)>

Get loyalty program Info Returns loyalty program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:

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

    LoyaltyProgram data, response status code and response headers



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

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

#get_lp_list(opts = {}) ⇒ LoyaltyProgramPage

Get loyalty program list Returns list of loyalty programs

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document in the page

  • :sort_field (String)

    Sort documents by field

  • :sort (String)

    Sort the documents in the ascending or descending order

Returns:



251
252
253
254
# File 'lib/brevo/api/program_api.rb', line 251

def get_lp_list(opts = {})
  data, _status_code, _headers = get_lp_list_with_http_info(opts)
  data
end

#get_lp_list_with_http_info(opts = {}) ⇒ Array<(LoyaltyProgramPage, Fixnum, Hash)>

Get loyalty program list Returns list of loyalty programs

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Number of documents per page

  • :offset (Integer)

    Index of the first document in the page

  • :sort_field (String)

    Sort documents by field

  • :sort (String)

    Sort the documents in the ascending or descending order

Returns:

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

    LoyaltyProgramPage data, response status code and response headers



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/brevo/api/program_api.rb', line 264

def get_lp_list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.get_lp_list ...'
  end
  if @api_client.config.client_side_validation && opts[:'sort_field'] && !['name', 'created_at', 'updated_at'].include?(opts[:'sort_field'])
    fail ArgumentError, 'invalid value for "sort_field", must be one of name, created_at, updated_at'
  end
  # resource path
  local_var_path = '/loyalty/config/programs'

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

#get_parameter_subscription_info(pid, opts = {}) ⇒ SubscriptionHandlerInfo

Get Subscription Data Get Information of balances, tiers, rewards and subscription members for a subscription

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Options Hash (opts):

  • :contact_id (String)

    Contact Id

  • :params (String)

    Filter List

  • :loyalty_subscription_id (String)

    Loyalty Subscription Id

Returns:



314
315
316
317
# File 'lib/brevo/api/program_api.rb', line 314

def get_parameter_subscription_info(pid, opts = {})
  data, _status_code, _headers = get_parameter_subscription_info_with_http_info(pid, opts)
  data
end

#get_parameter_subscription_info_with_http_info(pid, opts = {}) ⇒ Array<(SubscriptionHandlerInfo, Fixnum, Hash)>

Get Subscription Data Get Information of balances, tiers, rewards and subscription members for a subscription

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Options Hash (opts):

  • :contact_id (String)

    Contact Id

  • :params (String)

    Filter List

  • :loyalty_subscription_id (String)

    Loyalty Subscription Id

Returns:

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

    SubscriptionHandlerInfo data, response status code and response headers



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/brevo/api/program_api.rb', line 327

def get_parameter_subscription_info_with_http_info(pid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.get_parameter_subscription_info ...'
  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 ProgramApi.get_parameter_subscription_info"
  end
  # resource path
  local_var_path = '/loyalty/config/programs/{pid}/account-info'.sub('{' + 'pid' + '}', pid.to_s)

  # query parameters
  query_params = {}
  query_params[:'contactId'] = opts[:'contact_id'] if !opts[:'contact_id'].nil?
  query_params[:'params'] = opts[:'params'] if !opts[:'params'].nil?
  query_params[:'loyaltySubscriptionId'] = opts[:'loyalty_subscription_id'] if !opts[:'loyalty_subscription_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 => 'SubscriptionHandlerInfo')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#get_parameter_subscription_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#partially_update_loyalty_program(pid, body, opts = {}) ⇒ LoyaltyProgram

Partially update loyalty program Partially updates loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Loyalty Program Payload

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

    the optional parameters

Returns:



375
376
377
378
# File 'lib/brevo/api/program_api.rb', line 375

def partially_update_loyalty_program(pid, body, opts = {})
  data, _status_code, _headers = partially_update_loyalty_program_with_http_info(pid, body, opts)
  data
end

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

Partially update loyalty program Partially updates loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Loyalty Program Payload

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

    the optional parameters

Returns:

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

    LoyaltyProgram data, response status code and response headers



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/brevo/api/program_api.rb', line 386

def partially_update_loyalty_program_with_http_info(pid, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.partially_update_loyalty_program ...'
  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 ProgramApi.partially_update_loyalty_program"
  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 ProgramApi.partially_update_loyalty_program"
  end
  # resource path
  local_var_path = '/loyalty/config/programs/{pid}'.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(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'LoyaltyProgram')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#partially_update_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_loyalty_program(pid, opts = {}) ⇒ nil

Publish loyalty program Publishes loyalty program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:

  • (nil)


434
435
436
437
# File 'lib/brevo/api/program_api.rb', line 434

def publish_loyalty_program(pid, opts = {})
  publish_loyalty_program_with_http_info(pid, opts)
  nil
end

#publish_loyalty_program_with_http_info(pid, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Publish loyalty program Publishes loyalty program

Parameters:

  • pid

    Loyalty Program Id

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/brevo/api/program_api.rb', line 444

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

#subscribe_member_to_a_subscription(pid, body, opts = {}) ⇒ SubscriptionMember

Create subscription member Add member to a subscription

Parameters:

  • pid

    Loyalty Program Id

  • body

    Add Subscription Member Payload

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

    the optional parameters

Returns:



488
489
490
491
# File 'lib/brevo/api/program_api.rb', line 488

def subscribe_member_to_a_subscription(pid, body, opts = {})
  data, _status_code, _headers = subscribe_member_to_a_subscription_with_http_info(pid, body, opts)
  data
end

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

Create subscription member Add member to a subscription

Parameters:

  • pid

    Loyalty Program Id

  • body

    Add Subscription Member Payload

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

    the optional parameters

Returns:

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

    SubscriptionMember data, response status code and response headers



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

def subscribe_member_to_a_subscription_with_http_info(pid, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.subscribe_member_to_a_subscription ...'
  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 ProgramApi.subscribe_member_to_a_subscription"
  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 ProgramApi.subscribe_member_to_a_subscription"
  end
  # resource path
  local_var_path = '/loyalty/config/programs/{pid}/subscription-members'.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 => 'SubscriptionMember')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#subscribe_member_to_a_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#subscribe_to_loyalty_program(pid, body, opts = {}) ⇒ Subscription

Create subscription Subscribes to a loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Create Subscription Payload

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

    the optional parameters

Returns:



548
549
550
551
# File 'lib/brevo/api/program_api.rb', line 548

def subscribe_to_loyalty_program(pid, body, opts = {})
  data, _status_code, _headers = subscribe_to_loyalty_program_with_http_info(pid, body, opts)
  data
end

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

Create subscription Subscribes to a loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Create Subscription Payload

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

    the optional parameters

Returns:

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

    Subscription data, response status code and response headers



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
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/brevo/api/program_api.rb', line 559

def subscribe_to_loyalty_program_with_http_info(pid, body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ProgramApi.subscribe_to_loyalty_program ...'
  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 ProgramApi.subscribe_to_loyalty_program"
  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 ProgramApi.subscribe_to_loyalty_program"
  end
  # resource path
  local_var_path = '/loyalty/config/programs/{pid}/subscriptions'.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 => 'Subscription')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ProgramApi#subscribe_to_loyalty_program\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_loyalty_program(pid, body, opts = {}) ⇒ LoyaltyProgram

Update loyalty program Updates loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Update Loyalty Program Payload

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

    the optional parameters

Returns:



608
609
610
611
# File 'lib/brevo/api/program_api.rb', line 608

def update_loyalty_program(pid, body, opts = {})
  data, _status_code, _headers = update_loyalty_program_with_http_info(pid, body, opts)
  data
end

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

Update loyalty program Updates loyalty program

Parameters:

  • pid

    Loyalty Program Id

  • body

    Update Loyalty Program Payload

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

    the optional parameters

Returns:

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

    LoyaltyProgram data, response status code and response headers



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

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