Class: Brevo::SMSCampaignsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SMSCampaignsApi

Returns a new instance of SMSCampaignsApi.



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

def api_client
  @api_client
end

Instance Method Details

#create_sms_campaign(create_sms_campaign, opts = {}) ⇒ CreateModel

Creates an SMS campaign

Parameters:

  • create_sms_campaign

    Values to create an SMS Campaign

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

    the optional parameters

Returns:



36
37
38
39
# File 'lib/brevo/api/sms_campaigns_api.rb', line 36

def create_sms_campaign(create_sms_campaign, opts = {})
  data, _status_code, _headers = create_sms_campaign_with_http_info(create_sms_campaign, opts)
  data
end

#create_sms_campaign_with_http_info(create_sms_campaign, opts = {}) ⇒ Array<(CreateModel, Fixnum, Hash)>

Creates an SMS campaign

Parameters:

  • create_sms_campaign

    Values to create an SMS Campaign

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

    the optional parameters

Returns:

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

    CreateModel data, response status code and response headers



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

def create_sms_campaign_with_http_info(create_sms_campaign, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.create_sms_campaign ...'
  end
  # verify the required parameter 'create_sms_campaign' is set
  if @api_client.config.client_side_validation && create_sms_campaign.nil?
    fail ArgumentError, "Missing the required parameter 'create_sms_campaign' when calling SMSCampaignsApi.create_sms_campaign"
  end
  # resource path
  local_var_path = '/smsCampaigns'

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

#delete_sms_campaign(campaign_id, opts = {}) ⇒ nil

Delete an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

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

    the optional parameters

Returns:

  • (nil)


88
89
90
91
# File 'lib/brevo/api/sms_campaigns_api.rb', line 88

def delete_sms_campaign(campaign_id, opts = {})
  delete_sms_campaign_with_http_info(campaign_id, opts)
  nil
end

#delete_sms_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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

def delete_sms_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.delete_sms_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.delete_sms_campaign"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_id.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: SMSCampaignsApi#delete_sms_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sms_campaign(campaign_id, opts = {}) ⇒ GetSmsCampaign

Get an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

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

    the optional parameters

Returns:



139
140
141
142
# File 'lib/brevo/api/sms_campaigns_api.rb', line 139

def get_sms_campaign(campaign_id, opts = {})
  data, _status_code, _headers = get_sms_campaign_with_http_info(campaign_id, opts)
  data
end

#get_sms_campaign_with_http_info(campaign_id, opts = {}) ⇒ Array<(GetSmsCampaign, Fixnum, Hash)>

Get an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

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

    the optional parameters

Returns:

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

    GetSmsCampaign data, response status code and response headers



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/brevo/api/sms_campaigns_api.rb', line 148

def get_sms_campaign_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.get_sms_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.get_sms_campaign"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_id.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 => 'GetSmsCampaign')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSCampaignsApi#get_sms_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sms_campaigns(opts = {}) ⇒ GetSmsCampaigns

Returns the information for all your created SMS campaigns

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)

    Status of campaign.

  • :start_date (String)

    Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :limit (Integer)

    Number limitation for the result returned (default to 500)

  • :offset (Integer)

    Beginning point in the list to retrieve from. (default to 0)

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed (default to desc)

Returns:



196
197
198
199
# File 'lib/brevo/api/sms_campaigns_api.rb', line 196

def get_sms_campaigns(opts = {})
  data, _status_code, _headers = get_sms_campaigns_with_http_info(opts)
  data
end

#get_sms_campaigns_with_http_info(opts = {}) ⇒ Array<(GetSmsCampaigns, Fixnum, Hash)>

Returns the information for all your created SMS campaigns

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :status (String)

    Status of campaign.

  • :start_date (String)

    Mandatory if endDate is used. Starting (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :end_date (String)

    Mandatory if startDate is used. Ending (urlencoded) UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ) to filter the sent sms campaigns. Prefer to pass your timezone in date-time format for accurate result ( only available if either &#39;status&#39; not passed and if passed is set to &#39;sent&#39; )

  • :limit (Integer)

    Number limitation for the result returned

  • :offset (Integer)

    Beginning point in the list to retrieve from.

  • :sort (String)

    Sort the results in the ascending/descending order of record creation. Default order is descending if &#x60;sort&#x60; is not passed

Returns:

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

    GetSmsCampaigns data, response status code and response headers



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/brevo/api/sms_campaigns_api.rb', line 210

def get_sms_campaigns_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.get_sms_campaigns ...'
  end
  if @api_client.config.client_side_validation && opts[:'status'] && !['suspended', 'archive', 'sent', 'queued', 'draft', 'inProcess'].include?(opts[:'status'])
    fail ArgumentError, 'invalid value for "status", must be one of suspended, archive, sent, queued, draft, inProcess'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SMSCampaignsApi.get_sms_campaigns, must be smaller than or equal to 1000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 0
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling SMSCampaignsApi.get_sms_campaigns, 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
  # resource path
  local_var_path = '/smsCampaigns'

  # query parameters
  query_params = {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  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?

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

#request_sms_recipient_export(campaign_id, opts = {}) ⇒ CreatedProcessId

Export an SMS campaign’s recipients It returns the background process ID which on completion calls the notify URL that you have set in the input.

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Options Hash (opts):

Returns:



271
272
273
274
# File 'lib/brevo/api/sms_campaigns_api.rb', line 271

def request_sms_recipient_export(campaign_id, opts = {})
  data, _status_code, _headers = request_sms_recipient_export_with_http_info(campaign_id, opts)
  data
end

#request_sms_recipient_export_with_http_info(campaign_id, opts = {}) ⇒ Array<(CreatedProcessId, Fixnum, Hash)>

Export an SMS campaign&#39;s recipients It returns the background process ID which on completion calls the notify URL that you have set in the input.

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Options Hash (opts):

Returns:

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

    CreatedProcessId data, response status code and response headers



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/brevo/api/sms_campaigns_api.rb', line 282

def request_sms_recipient_export_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.request_sms_recipient_export ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.request_sms_recipient_export"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}/exportRecipients'.sub('{' + 'campaignId' + '}', campaign_id.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(opts[:'recipient_export'])
  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 => 'CreatedProcessId')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSCampaignsApi#request_sms_recipient_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_sms_campaign_now(campaign_id, opts = {}) ⇒ nil

Send your SMS campaign immediately

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Returns:

  • (nil)


325
326
327
328
# File 'lib/brevo/api/sms_campaigns_api.rb', line 325

def send_sms_campaign_now(campaign_id, opts = {})
  send_sms_campaign_now_with_http_info(campaign_id, opts)
  nil
end

#send_sms_campaign_now_with_http_info(campaign_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send your SMS campaign immediately

Parameters:

  • campaign_id

    id of the campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
369
370
371
# File 'lib/brevo/api/sms_campaigns_api.rb', line 334

def send_sms_campaign_now_with_http_info(campaign_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.send_sms_campaign_now ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.send_sms_campaign_now"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}/sendNow'.sub('{' + 'campaignId' + '}', campaign_id.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: SMSCampaignsApi#send_sms_campaign_now\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_sms_report(campaign_id, send_report, opts = {}) ⇒ nil

Send an SMS campaign’s report Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.

Parameters:

  • campaign_id

    id of the campaign

  • send_report

    Values for send a report

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

    the optional parameters

Returns:

  • (nil)


378
379
380
381
# File 'lib/brevo/api/sms_campaigns_api.rb', line 378

def send_sms_report(campaign_id, send_report, opts = {})
  send_sms_report_with_http_info(campaign_id, send_report, opts)
  nil
end

#send_sms_report_with_http_info(campaign_id, send_report, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send an SMS campaign&#39;s report Send report of Sent and Archived campaign, to the specified email addresses, with respective data and a pdf attachment in detail.

Parameters:

  • campaign_id

    id of the campaign

  • send_report

    Values for send a report

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
429
430
# File 'lib/brevo/api/sms_campaigns_api.rb', line 389

def send_sms_report_with_http_info(campaign_id, send_report, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.send_sms_report ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.send_sms_report"
  end
  # verify the required parameter 'send_report' is set
  if @api_client.config.client_side_validation && send_report.nil?
    fail ArgumentError, "Missing the required parameter 'send_report' when calling SMSCampaignsApi.send_sms_report"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}/sendReport'.sub('{' + 'campaignId' + '}', campaign_id.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(send_report)
  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: SMSCampaignsApi#send_sms_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_test_sms(campaign_id, phone_number, opts = {}) ⇒ nil

Send a test SMS campaign

Parameters:

  • campaign_id

    Id of the SMS campaign

  • phone_number

    Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted

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

    the optional parameters

Returns:

  • (nil)


436
437
438
439
# File 'lib/brevo/api/sms_campaigns_api.rb', line 436

def send_test_sms(campaign_id, phone_number, opts = {})
  send_test_sms_with_http_info(campaign_id, phone_number, opts)
  nil
end

#send_test_sms_with_http_info(campaign_id, phone_number, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Send a test SMS campaign

Parameters:

  • campaign_id

    Id of the SMS campaign

  • phone_number

    Mobile number of the recipient with the country code. This number must belong to one of your contacts in Brevo account and must not be blacklisted

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
482
483
484
485
486
487
# File 'lib/brevo/api/sms_campaigns_api.rb', line 446

def send_test_sms_with_http_info(campaign_id, phone_number, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.send_test_sms ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.send_test_sms"
  end
  # verify the required parameter 'phone_number' is set
  if @api_client.config.client_side_validation && phone_number.nil?
    fail ArgumentError, "Missing the required parameter 'phone_number' when calling SMSCampaignsApi.send_test_sms"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}/sendTest'.sub('{' + 'campaignId' + '}', campaign_id.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(phone_number)
  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: SMSCampaignsApi#send_test_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#setUserAgent(user_agent) ⇒ Object

Set custom user_agent if explicitly passed in api default will still remain Swagger-Codegen/#VERSION/ruby



25
26
27
28
29
30
# File 'lib/brevo/api/sms_campaigns_api.rb', line 25

def setUserAgent(user_agent)
  @user_agent = user_agent
  if user_agent.is_a?(String) && user_agent.downcase.start_with?('brevo_')
    @api_client.default_headers['User-Agent'] = @user_agent
  end
end

#update_sms_campaign(campaign_id, update_sms_campaign, opts = {}) ⇒ nil

Update an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

  • update_sms_campaign

    Values to update an SMS Campaign

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

    the optional parameters

Returns:

  • (nil)


493
494
495
496
# File 'lib/brevo/api/sms_campaigns_api.rb', line 493

def update_sms_campaign(campaign_id, update_sms_campaign, opts = {})
  update_sms_campaign_with_http_info(campaign_id, update_sms_campaign, opts)
  nil
end

#update_sms_campaign_status(campaign_id, status, opts = {}) ⇒ nil

Update a campaign’s status

Parameters:

  • campaign_id

    id of the campaign

  • status

    Status of the campaign.

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

    the optional parameters

Returns:

  • (nil)


550
551
552
553
# File 'lib/brevo/api/sms_campaigns_api.rb', line 550

def update_sms_campaign_status(campaign_id, status, opts = {})
  update_sms_campaign_status_with_http_info(campaign_id, status, opts)
  nil
end

#update_sms_campaign_status_with_http_info(campaign_id, status, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update a campaign&#39;s status

Parameters:

  • campaign_id

    id of the campaign

  • status

    Status of the campaign.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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/sms_campaigns_api.rb', line 560

def update_sms_campaign_status_with_http_info(campaign_id, status, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.update_sms_campaign_status ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.update_sms_campaign_status"
  end
  # verify the required parameter 'status' is set
  if @api_client.config.client_side_validation && status.nil?
    fail ArgumentError, "Missing the required parameter 'status' when calling SMSCampaignsApi.update_sms_campaign_status"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}/status'.sub('{' + 'campaignId' + '}', campaign_id.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(status)
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSCampaignsApi#update_sms_campaign_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_sms_campaign_with_http_info(campaign_id, update_sms_campaign, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update an SMS campaign

Parameters:

  • campaign_id

    id of the SMS campaign

  • update_sms_campaign

    Values to update an SMS Campaign

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/brevo/api/sms_campaigns_api.rb', line 503

def update_sms_campaign_with_http_info(campaign_id, update_sms_campaign, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSCampaignsApi.update_sms_campaign ...'
  end
  # verify the required parameter 'campaign_id' is set
  if @api_client.config.client_side_validation && campaign_id.nil?
    fail ArgumentError, "Missing the required parameter 'campaign_id' when calling SMSCampaignsApi.update_sms_campaign"
  end
  # verify the required parameter 'update_sms_campaign' is set
  if @api_client.config.client_side_validation && update_sms_campaign.nil?
    fail ArgumentError, "Missing the required parameter 'update_sms_campaign' when calling SMSCampaignsApi.update_sms_campaign"
  end
  # resource path
  local_var_path = '/smsCampaigns/{campaignId}'.sub('{' + 'campaignId' + '}', campaign_id.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(update_sms_campaign)
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSCampaignsApi#update_sms_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end