Class: Zyphr::SMSApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zyphr/api/sms_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SMSApi

Returns a new instance of SMSApi.



19
20
21
# File 'lib/zyphr/api/sms_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/zyphr/api/sms_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_sms_config(opts = {}) ⇒ SmsConfigDeleteResponse

Delete SMS configuration Remove the SMS provider configuration for the account.

Parameters:

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

    the optional parameters

Returns:



26
27
28
29
# File 'lib/zyphr/api/sms_api.rb', line 26

def delete_sms_config(opts = {})
  data, _status_code, _headers = delete_sms_config_with_http_info(opts)
  data
end

#delete_sms_config_with_http_info(opts = {}) ⇒ Array<(SmsConfigDeleteResponse, Integer, Hash)>

Delete SMS configuration Remove the SMS provider configuration for the account.

Parameters:

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

    the optional parameters

Returns:

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

    SmsConfigDeleteResponse data, response status code and response headers



35
36
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
76
77
# File 'lib/zyphr/api/sms_api.rb', line 35

def delete_sms_config_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.delete_sms_config ...'
  end
  # resource path
  local_var_path = '/sms/config'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SmsConfigDeleteResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.delete_sms_config",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#delete_sms_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sms(id, opts = {}) ⇒ SmsDetailResponse

Get SMS message details Get detailed information about a specific SMS message.

Parameters:

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

    the optional parameters

Returns:



84
85
86
87
# File 'lib/zyphr/api/sms_api.rb', line 84

def get_sms(id, opts = {})
  data, _status_code, _headers = get_sms_with_http_info(id, opts)
  data
end

#get_sms_config(opts = {}) ⇒ SmsConfigResponse

Get SMS configuration Get the current SMS provider configuration for the account.

Parameters:

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

    the optional parameters

Returns:



146
147
148
149
# File 'lib/zyphr/api/sms_api.rb', line 146

def get_sms_config(opts = {})
  data, _status_code, _headers = get_sms_config_with_http_info(opts)
  data
end

#get_sms_config_with_http_info(opts = {}) ⇒ Array<(SmsConfigResponse, Integer, Hash)>

Get SMS configuration Get the current SMS provider configuration for the account.

Parameters:

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

    the optional parameters

Returns:

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

    SmsConfigResponse data, response status code and response headers



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
189
190
191
192
193
194
195
196
197
# File 'lib/zyphr/api/sms_api.rb', line 155

def get_sms_config_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.get_sms_config ...'
  end
  # resource path
  local_var_path = '/sms/config'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SmsConfigResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.get_sms_config",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#get_sms_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sms_inbound_webhook(opts = {}) ⇒ nil

Get the inbound SMS webhook URL Returns the URL to configure in your SMS provider so STOP/opt-out replies reach Zyphr. The token is generated on first request and is stable thereafter. This is required for TCPA compliance. Until your provider is pointed at this URL, opt-out replies stop at the provider and never reach us — from Zyphr's side the recipient never opted out, and sends continue. See Compliance Requirements.

Parameters:

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

    the optional parameters

Returns:

  • (nil)


203
204
205
206
# File 'lib/zyphr/api/sms_api.rb', line 203

def get_sms_inbound_webhook(opts = {})
  get_sms_inbound_webhook_with_http_info(opts)
  nil
end

#get_sms_inbound_webhook_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get the inbound SMS webhook URL Returns the URL to configure in your SMS provider so STOP/opt-out replies reach Zyphr. The token is generated on first request and is stable thereafter. This is required for TCPA compliance. Until your provider is pointed at this URL, opt-out replies stop at the provider and never reach us — from Zyphr's side the recipient never opted out, and sends continue. See Compliance Requirements.

Parameters:

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
# File 'lib/zyphr/api/sms_api.rb', line 212

def get_sms_inbound_webhook_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.get_sms_inbound_webhook ...'
  end
  # resource path
  local_var_path = '/sms/inbound-webhook'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.get_sms_inbound_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#get_sms_inbound_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_sms_with_http_info(id, opts = {}) ⇒ Array<(SmsDetailResponse, Integer, Hash)>

Get SMS message details Get detailed information about a specific SMS message.

Parameters:

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

    the optional parameters

Returns:

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

    SmsDetailResponse data, response status code and response headers



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
136
137
138
139
140
# File 'lib/zyphr/api/sms_api.rb', line 94

def get_sms_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.get_sms ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling SMSApi.get_sms"
  end
  # resource path
  local_var_path = '/sms/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SmsDetailResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.get_sms",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#get_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_sms(opts = {}) ⇒ SmsListResponse

List SMS messages List SMS messages for the account with optional filtering and pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 25
  • :status (String)
  • :search (String)

    Search by phone number or message body

Returns:



262
263
264
265
# File 'lib/zyphr/api/sms_api.rb', line 262

def list_sms(opts = {})
  data, _status_code, _headers = list_sms_with_http_info(opts)
  data
end

#list_sms_with_http_info(opts = {}) ⇒ Array<(SmsListResponse, Integer, Hash)>

List SMS messages List SMS messages for the account with optional filtering and pagination.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :per_page (Integer) — default: default to 25
  • :status (String)
  • :search (String)

    Search by phone number or message body

Returns:

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

    SmsListResponse data, response status code and response headers



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/zyphr/api/sms_api.rb', line 275

def list_sms_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.list_sms ...'
  end
  if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 100
    fail ArgumentError, 'invalid value for "opts[:"per_page"]" when calling SMSApi.list_sms, must be smaller than or equal to 100.'
  end

  allowable_values = ["queued", "sending", "sent", "delivered", "undelivered", "failed"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/sms'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SmsListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.list_sms",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#list_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_batch_sms(send_batch_sms_request, opts = {}) ⇒ SendBatchSmsResponse

Send batch SMS messages Send SMS messages to multiple recipients (up to 100) in a single request.

Parameters:

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

    the optional parameters

Returns:



336
337
338
339
# File 'lib/zyphr/api/sms_api.rb', line 336

def send_batch_sms(send_batch_sms_request, opts = {})
  data, _status_code, _headers = send_batch_sms_with_http_info(send_batch_sms_request, opts)
  data
end

#send_batch_sms_with_http_info(send_batch_sms_request, opts = {}) ⇒ Array<(SendBatchSmsResponse, Integer, Hash)>

Send batch SMS messages Send SMS messages to multiple recipients (up to 100) in a single request.

Parameters:

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

    the optional parameters

Returns:

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

    SendBatchSmsResponse data, response status code and response headers



346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/zyphr/api/sms_api.rb', line 346

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_batch_sms_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendBatchSmsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.send_batch_sms",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#send_batch_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_sms(send_sms_request, opts = {}) ⇒ SendSmsResponse

Send an SMS message Send a single SMS text message. Supports subscriber preference checks and scheduling. TCPA compliance — actions required from you: - Configure the inbound webhook. Zyphr only processes STOP/opt-out replies if your SMS provider is pointed at our inbound endpoint. Until you do this, opt-outs never reach us and we will keep delivering. See Compliance Requirements. - Pass recipient_timezone (IANA, e.g. America/New_York) so quiet hours (8am-9pm recipient-local) can be enforced. Without it we send and record that quiet hours could not be evaluated. We deliberately do not infer a timezone from the area code — people keep numbers when they move. - Record consent for marketing sends. Marketing requires prior express written consent; express consent covers transactional only. With no record on file we deliver and flag it, which is a gap in your evidence, not permission. - Set classification. Unclassified messages are treated as marketing, the stricter reading.

Parameters:

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

    the optional parameters

Returns:



404
405
406
407
# File 'lib/zyphr/api/sms_api.rb', line 404

def send_sms(send_sms_request, opts = {})
  data, _status_code, _headers = send_sms_with_http_info(send_sms_request, opts)
  data
end

#send_sms_with_http_info(send_sms_request, opts = {}) ⇒ Array<(SendSmsResponse, Integer, Hash)>

Send an SMS message Send a single SMS text message. Supports subscriber preference checks and scheduling. TCPA compliance — actions required from you: - Configure the inbound webhook. Zyphr only processes STOP/opt-out replies if your SMS provider is pointed at our inbound endpoint. Until you do this, opt-outs never reach us and we will keep delivering. See Compliance Requirements. - Pass `recipient_timezone` (IANA, e.g. `America/New_York`) so quiet hours (8am-9pm recipient-local) can be enforced. Without it we send and record that quiet hours could not be evaluated. We deliberately do not infer a timezone from the area code — people keep numbers when they move. - Record consent for marketing sends. Marketing requires prior express written consent; `express` consent covers transactional only. With no record on file we deliver and flag it, which is a gap in your evidence, not permission. - Set `classification`. Unclassified messages are treated as marketing, the stricter reading.

Parameters:

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

    the optional parameters

Returns:

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

    SendSmsResponse data, response status code and response headers



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/zyphr/api/sms_api.rb', line 414

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_sms_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendSmsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.send_sms",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#send_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#send_test_sms(send_test_sms_request, opts = {}) ⇒ SendTestSmsResponse

Send a test SMS Send a test SMS message to verify the provider configuration is working.

Parameters:

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

    the optional parameters

Returns:



472
473
474
475
# File 'lib/zyphr/api/sms_api.rb', line 472

def send_test_sms(send_test_sms_request, opts = {})
  data, _status_code, _headers = send_test_sms_with_http_info(send_test_sms_request, opts)
  data
end

#send_test_sms_with_http_info(send_test_sms_request, opts = {}) ⇒ Array<(SendTestSmsResponse, Integer, Hash)>

Send a test SMS Send a test SMS message to verify the provider configuration is working.

Parameters:

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

    the optional parameters

Returns:

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

    SendTestSmsResponse data, response status code and response headers



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
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/zyphr/api/sms_api.rb', line 482

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(send_test_sms_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SendTestSmsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.send_test_sms",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#send_test_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#upsert_sms_config(upsert_sms_config_request, opts = {}) ⇒ SmsConfigResponse

Create or update SMS configuration Set up or update the SMS provider configuration (Twilio) for the account. Automatically verifies credentials.

Parameters:

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

    the optional parameters

Returns:



540
541
542
543
# File 'lib/zyphr/api/sms_api.rb', line 540

def upsert_sms_config(upsert_sms_config_request, opts = {})
  data, _status_code, _headers = upsert_sms_config_with_http_info(upsert_sms_config_request, opts)
  data
end

#upsert_sms_config_with_http_info(upsert_sms_config_request, opts = {}) ⇒ Array<(SmsConfigResponse, Integer, Hash)>

Create or update SMS configuration Set up or update the SMS provider configuration (Twilio) for the account. Automatically verifies credentials.

Parameters:

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

    the optional parameters

Returns:

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

    SmsConfigResponse data, response status code and response headers



550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/zyphr/api/sms_api.rb', line 550

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

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(upsert_sms_config_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SmsConfigResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.upsert_sms_config",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#upsert_sms_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_sms_config(opts = {}) ⇒ VerifySmsConfigResponse

Verify SMS configuration Verify the SMS provider credentials are valid and working.

Parameters:

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

    the optional parameters

Returns:



607
608
609
610
# File 'lib/zyphr/api/sms_api.rb', line 607

def verify_sms_config(opts = {})
  data, _status_code, _headers = verify_sms_config_with_http_info(opts)
  data
end

#verify_sms_config_with_http_info(opts = {}) ⇒ Array<(VerifySmsConfigResponse, Integer, Hash)>

Verify SMS configuration Verify the SMS provider credentials are valid and working.

Parameters:

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

    the optional parameters

Returns:

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

    VerifySmsConfigResponse data, response status code and response headers



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
# File 'lib/zyphr/api/sms_api.rb', line 616

def verify_sms_config_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SMSApi.verify_sms_config ...'
  end
  # resource path
  local_var_path = '/sms/config/verify'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'VerifySmsConfigResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SMSApi.verify_sms_config",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SMSApi#verify_sms_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end