twilio-ruby 5.22.0 → 5.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +15 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/client.rb +7 -0
  5. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  6. data/lib/twilio-ruby/rest/messaging/v1/session.rb +1 -7
  7. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +34 -32
  8. data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +37 -35
  9. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +45 -38
  10. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +38 -34
  11. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +67 -52
  12. data/lib/twilio-ruby/rest/proxy/v1/service/short_code.rb +32 -23
  13. data/lib/twilio-ruby/rest/proxy/v1/service.rb +123 -79
  14. data/lib/twilio-ruby/rest/proxy/v1.rb +2 -1
  15. data/lib/twilio-ruby/rest/proxy.rb +2 -1
  16. data/lib/twilio-ruby/rest/serverless/v1/service/asset/asset_version.rb +366 -0
  17. data/lib/twilio-ruby/rest/serverless/v1/service/asset.rb +384 -0
  18. data/lib/twilio-ruby/rest/serverless/v1/service/build.rb +348 -0
  19. data/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +358 -0
  20. data/lib/twilio-ruby/rest/serverless/v1/service/environment/variable.rb +398 -0
  21. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +417 -0
  22. data/lib/twilio-ruby/rest/serverless/v1/service/function/function_version.rb +366 -0
  23. data/lib/twilio-ruby/rest/serverless/v1/service/function.rb +384 -0
  24. data/lib/twilio-ruby/rest/{verify → serverless}/v1/service.rb +139 -175
  25. data/lib/twilio-ruby/rest/{verify → serverless}/v1.rb +6 -6
  26. data/lib/twilio-ruby/rest/serverless.rb +46 -0
  27. data/lib/twilio-ruby/rest/trunking/v1/trunk/terminating_sip_domain.rb +419 -0
  28. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +26 -0
  29. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +46 -38
  30. data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +24 -20
  31. data/lib/twilio-ruby/rest/verify/v2/service.rb +59 -57
  32. data/lib/twilio-ruby/rest/verify/v2.rb +2 -1
  33. data/lib/twilio-ruby/rest/verify.rb +2 -8
  34. data/lib/twilio-ruby/version.rb +1 -1
  35. data/spec/integration/flex_api/v1/configuration_spec.rb +15 -0
  36. data/spec/integration/messaging/v1/session/participant_spec.rb +10 -10
  37. data/spec/integration/serverless/v1/service/asset/asset_version_spec.rb +144 -0
  38. data/spec/integration/serverless/v1/service/asset_spec.rb +177 -0
  39. data/spec/integration/serverless/v1/service/build_spec.rb +184 -0
  40. data/spec/integration/serverless/v1/service/environment/deployment_spec.rb +137 -0
  41. data/spec/integration/serverless/v1/service/environment/variable_spec.rb +181 -0
  42. data/spec/integration/serverless/v1/service/environment_spec.rb +143 -0
  43. data/spec/integration/serverless/v1/service/function/function_version_spec.rb +144 -0
  44. data/spec/integration/serverless/v1/service/function_spec.rb +177 -0
  45. data/spec/integration/serverless/v1/service_spec.rb +180 -0
  46. data/spec/integration/trunking/v1/trunk/terminating_sip_domain_spec.rb +231 -0
  47. data/spec/integration/trunking/v1/trunk_spec.rb +12 -6
  48. metadata +34 -12
  49. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +0 -340
  50. data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +0 -209
  51. data/spec/integration/verify/v1/service/verification_check_spec.rb +0 -54
  52. data/spec/integration/verify/v1/service/verification_spec.rb +0 -169
  53. data/spec/integration/verify/v1/service_spec.rb +0 -231
@@ -8,10 +8,10 @@
8
8
 
9
9
  module Twilio
10
10
  module REST
11
- class Verify < Domain
11
+ class Serverless < Domain
12
12
  class V1 < Version
13
13
  ##
14
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
14
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
15
15
  class ServiceList < ListResource
16
16
  ##
17
17
  # Initialize the ServiceList
@@ -25,44 +25,6 @@ module Twilio
25
25
  @uri = "/Services"
26
26
  end
27
27
 
28
- ##
29
- # Retrieve a single page of ServiceInstance records from the API.
30
- # Request is executed immediately.
31
- # @param [String] friendly_name A 1-64 character string with friendly name of
32
- # service
33
- # @param [String] code_length The length of the verification code to be generated.
34
- # Must be an integer value between 4-10
35
- # @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
36
- # be performed with each verification started and associated info returned
37
- # @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
38
- # not to ignore SMS verifications for landlines, depends on lookup_enabled flag
39
- # @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
40
- # to require a random number input to deliver the verify code via phone calls
41
- # @param [String] tts_name Alternative to be used as Service friendly name in
42
- # phone calls, only applies to TTS languages
43
- # @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
44
- # transaction parameters when starting a verification
45
- # @return [ServiceInstance] Newly created ServiceInstance
46
- def create(friendly_name: nil, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
47
- data = Twilio::Values.of({
48
- 'FriendlyName' => friendly_name,
49
- 'CodeLength' => code_length,
50
- 'LookupEnabled' => lookup_enabled,
51
- 'SkipSmsToLandlines' => skip_sms_to_landlines,
52
- 'DtmfInputRequired' => dtmf_input_required,
53
- 'TtsName' => tts_name,
54
- 'Psd2Enabled' => psd2_enabled,
55
- })
56
-
57
- payload = @version.create(
58
- 'POST',
59
- @uri,
60
- data: data
61
- )
62
-
63
- ServiceInstance.new(@version, payload, )
64
- end
65
-
66
28
  ##
67
29
  # Lists ServiceInstance records from the API as a list.
68
30
  # Unlike stream(), this operation is eager and will load `limit` records into
@@ -145,15 +107,38 @@ module Twilio
145
107
  ServicePage.new(@version, response, @solution)
146
108
  end
147
109
 
110
+ ##
111
+ # Retrieve a single page of ServiceInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [String] unique_name The unique_name
114
+ # @param [String] friendly_name The friendly_name
115
+ # @param [Boolean] include_credentials The include_credentials
116
+ # @return [ServiceInstance] Newly created ServiceInstance
117
+ def create(unique_name: nil, friendly_name: nil, include_credentials: :unset)
118
+ data = Twilio::Values.of({
119
+ 'UniqueName' => unique_name,
120
+ 'FriendlyName' => friendly_name,
121
+ 'IncludeCredentials' => include_credentials,
122
+ })
123
+
124
+ payload = @version.create(
125
+ 'POST',
126
+ @uri,
127
+ data: data
128
+ )
129
+
130
+ ServiceInstance.new(@version, payload, )
131
+ end
132
+
148
133
  ##
149
134
  # Provide a user friendly representation
150
135
  def to_s
151
- '#<Twilio.Verify.V1.ServiceList>'
136
+ '#<Twilio.Serverless.V1.ServiceList>'
152
137
  end
153
138
  end
154
139
 
155
140
  ##
156
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
141
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
157
142
  class ServicePage < Page
158
143
  ##
159
144
  # Initialize the ServicePage
@@ -179,17 +164,17 @@ module Twilio
179
164
  ##
180
165
  # Provide a user friendly representation
181
166
  def to_s
182
- '<Twilio.Verify.V1.ServicePage>'
167
+ '<Twilio.Serverless.V1.ServicePage>'
183
168
  end
184
169
  end
185
170
 
186
171
  ##
187
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
172
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
188
173
  class ServiceContext < InstanceContext
189
174
  ##
190
175
  # Initialize the ServiceContext
191
176
  # @param [Version] version Version that contains the resource
192
- # @param [String] sid The unique SID identifier of Verification Service Instance.
177
+ # @param [String] sid The sid
193
178
  # @return [ServiceContext] ServiceContext
194
179
  def initialize(version, sid)
195
180
  super(version)
@@ -199,8 +184,10 @@ module Twilio
199
184
  @uri = "/Services/#{@solution[:sid]}"
200
185
 
201
186
  # Dependents
202
- @verifications = nil
203
- @verification_checks = nil
187
+ @environments = nil
188
+ @functions = nil
189
+ @assets = nil
190
+ @builds = nil
204
191
  end
205
192
 
206
193
  ##
@@ -218,39 +205,15 @@ module Twilio
218
205
  ServiceInstance.new(@version, payload, sid: @solution[:sid], )
219
206
  end
220
207
 
221
- ##
222
- # Deletes the ServiceInstance
223
- # @return [Boolean] true if delete succeeds, true otherwise
224
- def delete
225
- @version.delete('delete', @uri)
226
- end
227
-
228
208
  ##
229
209
  # Update the ServiceInstance
230
- # @param [String] friendly_name A 1-64 character string with friendly name of
231
- # service
232
- # @param [String] code_length The length of the verification code to be generated.
233
- # Must be an integer value between 4-10
234
- # @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
235
- # be performed with each verification started and associated info returned
236
- # @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
237
- # not to ignore SMS verifications for landlines, depends on lookup_enabled flag
238
- # @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
239
- # to require a random number input to deliver the verify code via phone calls
240
- # @param [String] tts_name Alternative to be used as Service friendly name in
241
- # phone calls, only applies to TTS languages
242
- # @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
243
- # transaction parameters when starting a verification
210
+ # @param [Boolean] include_credentials The include_credentials
211
+ # @param [String] friendly_name The friendly_name
244
212
  # @return [ServiceInstance] Updated ServiceInstance
245
- def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
213
+ def update(include_credentials: :unset, friendly_name: :unset)
246
214
  data = Twilio::Values.of({
215
+ 'IncludeCredentials' => include_credentials,
247
216
  'FriendlyName' => friendly_name,
248
- 'CodeLength' => code_length,
249
- 'LookupEnabled' => lookup_enabled,
250
- 'SkipSmsToLandlines' => skip_sms_to_landlines,
251
- 'DtmfInputRequired' => dtmf_input_required,
252
- 'TtsName' => tts_name,
253
- 'Psd2Enabled' => psd2_enabled,
254
217
  })
255
218
 
256
219
  payload = @version.update(
@@ -263,58 +226,100 @@ module Twilio
263
226
  end
264
227
 
265
228
  ##
266
- # Access the verifications
267
- # @return [VerificationList]
268
- # @return [VerificationContext] if sid was passed.
269
- def verifications(sid=:unset)
229
+ # Access the environments
230
+ # @return [EnvironmentList]
231
+ # @return [EnvironmentContext] if sid was passed.
232
+ def environments(sid=:unset)
233
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
234
+
235
+ if sid != :unset
236
+ return EnvironmentContext.new(@version, @solution[:sid], sid, )
237
+ end
238
+
239
+ unless @environments
240
+ @environments = EnvironmentList.new(@version, service_sid: @solution[:sid], )
241
+ end
242
+
243
+ @environments
244
+ end
245
+
246
+ ##
247
+ # Access the functions
248
+ # @return [FunctionList]
249
+ # @return [FunctionContext] if sid was passed.
250
+ def functions(sid=:unset)
270
251
  raise ArgumentError, 'sid cannot be nil' if sid.nil?
271
252
 
272
253
  if sid != :unset
273
- return VerificationContext.new(@version, @solution[:sid], sid, )
254
+ return FunctionContext.new(@version, @solution[:sid], sid, )
274
255
  end
275
256
 
276
- unless @verifications
277
- @verifications = VerificationList.new(@version, service_sid: @solution[:sid], )
257
+ unless @functions
258
+ @functions = FunctionList.new(@version, service_sid: @solution[:sid], )
278
259
  end
279
260
 
280
- @verifications
261
+ @functions
281
262
  end
282
263
 
283
264
  ##
284
- # Access the verification_checks
285
- # @return [VerificationCheckList]
286
- # @return [VerificationCheckContext]
287
- def verification_checks
288
- unless @verification_checks
289
- @verification_checks = VerificationCheckList.new(@version, service_sid: @solution[:sid], )
265
+ # Access the assets
266
+ # @return [AssetList]
267
+ # @return [AssetContext] if sid was passed.
268
+ def assets(sid=:unset)
269
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
270
+
271
+ if sid != :unset
272
+ return AssetContext.new(@version, @solution[:sid], sid, )
273
+ end
274
+
275
+ unless @assets
276
+ @assets = AssetList.new(@version, service_sid: @solution[:sid], )
277
+ end
278
+
279
+ @assets
280
+ end
281
+
282
+ ##
283
+ # Access the builds
284
+ # @return [BuildList]
285
+ # @return [BuildContext] if sid was passed.
286
+ def builds(sid=:unset)
287
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
288
+
289
+ if sid != :unset
290
+ return BuildContext.new(@version, @solution[:sid], sid, )
291
+ end
292
+
293
+ unless @builds
294
+ @builds = BuildList.new(@version, service_sid: @solution[:sid], )
290
295
  end
291
296
 
292
- @verification_checks
297
+ @builds
293
298
  end
294
299
 
295
300
  ##
296
301
  # Provide a user friendly representation
297
302
  def to_s
298
303
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
299
- "#<Twilio.Verify.V1.ServiceContext #{context}>"
304
+ "#<Twilio.Serverless.V1.ServiceContext #{context}>"
300
305
  end
301
306
 
302
307
  ##
303
308
  # Provide a detailed, user friendly representation
304
309
  def inspect
305
310
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
306
- "#<Twilio.Verify.V1.ServiceContext #{context}>"
311
+ "#<Twilio.Serverless.V1.ServiceContext #{context}>"
307
312
  end
308
313
  end
309
314
 
310
315
  ##
311
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
316
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
312
317
  class ServiceInstance < InstanceResource
313
318
  ##
314
319
  # Initialize the ServiceInstance
315
320
  # @param [Version] version Version that contains the resource
316
321
  # @param [Hash] payload payload that contains response from Twilio
317
- # @param [String] sid The unique SID identifier of Verification Service Instance.
322
+ # @param [String] sid The sid
318
323
  # @return [ServiceInstance] ServiceInstance
319
324
  def initialize(version, payload, sid: nil)
320
325
  super(version)
@@ -324,12 +329,8 @@ module Twilio
324
329
  'sid' => payload['sid'],
325
330
  'account_sid' => payload['account_sid'],
326
331
  'friendly_name' => payload['friendly_name'],
327
- 'code_length' => payload['code_length'].to_i,
328
- 'lookup_enabled' => payload['lookup_enabled'],
329
- 'psd2_enabled' => payload['psd2_enabled'],
330
- 'skip_sms_to_landlines' => payload['skip_sms_to_landlines'],
331
- 'dtmf_input_required' => payload['dtmf_input_required'],
332
- 'tts_name' => payload['tts_name'],
332
+ 'unique_name' => payload['unique_name'],
333
+ 'include_credentials' => payload['include_credentials'],
333
334
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
334
335
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
335
336
  'url' => payload['url'],
@@ -353,67 +354,43 @@ module Twilio
353
354
  end
354
355
 
355
356
  ##
356
- # @return [String] A string that uniquely identifies this Service.
357
+ # @return [String] The sid
357
358
  def sid
358
359
  @properties['sid']
359
360
  end
360
361
 
361
362
  ##
362
- # @return [String] Account Sid.
363
+ # @return [String] The account_sid
363
364
  def account_sid
364
365
  @properties['account_sid']
365
366
  end
366
367
 
367
368
  ##
368
- # @return [String] Friendly name of the service
369
+ # @return [String] The friendly_name
369
370
  def friendly_name
370
371
  @properties['friendly_name']
371
372
  end
372
373
 
373
374
  ##
374
- # @return [String] Length of verification code. Valid values are 4-10
375
- def code_length
376
- @properties['code_length']
375
+ # @return [String] The unique_name
376
+ def unique_name
377
+ @properties['unique_name']
377
378
  end
378
379
 
379
380
  ##
380
- # @return [Boolean] Indicates whether or not to perform a lookup with each verification started
381
- def lookup_enabled
382
- @properties['lookup_enabled']
381
+ # @return [Boolean] The include_credentials
382
+ def include_credentials
383
+ @properties['include_credentials']
383
384
  end
384
385
 
385
386
  ##
386
- # @return [Boolean] Indicates whether PSD2 parameters are enabled or not
387
- def psd2_enabled
388
- @properties['psd2_enabled']
389
- end
390
-
391
- ##
392
- # @return [Boolean] Indicates whether or not to ignore SMS verifications for landlines
393
- def skip_sms_to_landlines
394
- @properties['skip_sms_to_landlines']
395
- end
396
-
397
- ##
398
- # @return [Boolean] Indicates whether or not to require a random number input to deliver the verify code via phone calls
399
- def dtmf_input_required
400
- @properties['dtmf_input_required']
401
- end
402
-
403
- ##
404
- # @return [String] Alternative to be used as Service friendly name in phone calls
405
- def tts_name
406
- @properties['tts_name']
407
- end
408
-
409
- ##
410
- # @return [Time] The date this Service was created
387
+ # @return [Time] The date_created
411
388
  def date_created
412
389
  @properties['date_created']
413
390
  end
414
391
 
415
392
  ##
416
- # @return [Time] The date this Service was updated
393
+ # @return [Time] The date_updated
417
394
  def date_updated
418
395
  @properties['date_updated']
419
396
  end
@@ -438,67 +415,54 @@ module Twilio
438
415
  end
439
416
 
440
417
  ##
441
- # Deletes the ServiceInstance
442
- # @return [Boolean] true if delete succeeds, true otherwise
443
- def delete
444
- context.delete
418
+ # Update the ServiceInstance
419
+ # @param [Boolean] include_credentials The include_credentials
420
+ # @param [String] friendly_name The friendly_name
421
+ # @return [ServiceInstance] Updated ServiceInstance
422
+ def update(include_credentials: :unset, friendly_name: :unset)
423
+ context.update(include_credentials: include_credentials, friendly_name: friendly_name, )
445
424
  end
446
425
 
447
426
  ##
448
- # Update the ServiceInstance
449
- # @param [String] friendly_name A 1-64 character string with friendly name of
450
- # service
451
- # @param [String] code_length The length of the verification code to be generated.
452
- # Must be an integer value between 4-10
453
- # @param [Boolean] lookup_enabled Boolean value that indicates if a lookup should
454
- # be performed with each verification started and associated info returned
455
- # @param [Boolean] skip_sms_to_landlines Boolean value that indicates whether or
456
- # not to ignore SMS verifications for landlines, depends on lookup_enabled flag
457
- # @param [Boolean] dtmf_input_required Boolean value that indicates whether or not
458
- # to require a random number input to deliver the verify code via phone calls
459
- # @param [String] tts_name Alternative to be used as Service friendly name in
460
- # phone calls, only applies to TTS languages
461
- # @param [Boolean] psd2_enabled Boolean value that enables to pass PSD2
462
- # transaction parameters when starting a verification
463
- # @return [ServiceInstance] Updated ServiceInstance
464
- def update(friendly_name: :unset, code_length: :unset, lookup_enabled: :unset, skip_sms_to_landlines: :unset, dtmf_input_required: :unset, tts_name: :unset, psd2_enabled: :unset)
465
- context.update(
466
- friendly_name: friendly_name,
467
- code_length: code_length,
468
- lookup_enabled: lookup_enabled,
469
- skip_sms_to_landlines: skip_sms_to_landlines,
470
- dtmf_input_required: dtmf_input_required,
471
- tts_name: tts_name,
472
- psd2_enabled: psd2_enabled,
473
- )
427
+ # Access the environments
428
+ # @return [environments] environments
429
+ def environments
430
+ context.environments
431
+ end
432
+
433
+ ##
434
+ # Access the functions
435
+ # @return [functions] functions
436
+ def functions
437
+ context.functions
474
438
  end
475
439
 
476
440
  ##
477
- # Access the verifications
478
- # @return [verifications] verifications
479
- def verifications
480
- context.verifications
441
+ # Access the assets
442
+ # @return [assets] assets
443
+ def assets
444
+ context.assets
481
445
  end
482
446
 
483
447
  ##
484
- # Access the verification_checks
485
- # @return [verification_checks] verification_checks
486
- def verification_checks
487
- context.verification_checks
448
+ # Access the builds
449
+ # @return [builds] builds
450
+ def builds
451
+ context.builds
488
452
  end
489
453
 
490
454
  ##
491
455
  # Provide a user friendly representation
492
456
  def to_s
493
457
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
494
- "<Twilio.Verify.V1.ServiceInstance #{values}>"
458
+ "<Twilio.Serverless.V1.ServiceInstance #{values}>"
495
459
  end
496
460
 
497
461
  ##
498
462
  # Provide a detailed, user friendly representation
499
463
  def inspect
500
464
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
501
- "<Twilio.Verify.V1.ServiceInstance #{values}>"
465
+ "<Twilio.Serverless.V1.ServiceInstance #{values}>"
502
466
  end
503
467
  end
504
468
  end