twilio-ruby 5.52.0 → 5.67.3

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 (163) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/pr-lint.yml +15 -0
  3. data/.github/workflows/test-and-deploy.yml +129 -0
  4. data/.gitignore +5 -1
  5. data/.rubocop.yml +1 -1
  6. data/.rubocop_todo.yml +91 -28
  7. data/CHANGES.md +563 -0
  8. data/Gemfile +1 -0
  9. data/Makefile +8 -11
  10. data/README.md +13 -6
  11. data/examples/examples.rb +1 -1
  12. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  13. data/lib/twilio-ruby/http/http_client.rb +20 -4
  14. data/lib/twilio-ruby/http.rb +5 -0
  15. data/lib/twilio-ruby/jwt/access_token.rb +13 -0
  16. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +23 -23
  17. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +5 -5
  18. data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +8 -8
  19. data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +674 -0
  20. data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
  21. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +68 -14
  22. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +12 -8
  23. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  24. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +11 -4
  25. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +11 -4
  26. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +11 -4
  27. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +17 -10
  28. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +18 -5
  29. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +34 -7
  30. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  31. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  32. data/lib/twilio-ruby/rest/bulkexports/v1/export/day.rb +0 -8
  33. data/lib/twilio-ruby/rest/bulkexports/v1/export/export_custom_job.rb +0 -6
  34. data/lib/twilio-ruby/rest/bulkexports/v1/export/job.rb +0 -8
  35. data/lib/twilio-ruby/rest/bulkexports/v1/export.rb +0 -8
  36. data/lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb +0 -8
  37. data/lib/twilio-ruby/rest/chat/v2/service/user/user_channel.rb +10 -4
  38. data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
  39. data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
  40. data/lib/twilio-ruby/rest/chat.rb +16 -0
  41. data/lib/twilio-ruby/rest/client.rb +21 -12
  42. data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +454 -0
  43. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  44. data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +7 -0
  45. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  46. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/notification.rb +18 -2
  47. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  48. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  49. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  50. data/lib/twilio-ruby/rest/conversations/v1/service/conversation.rb +7 -0
  51. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  52. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +466 -0
  53. data/lib/twilio-ruby/rest/conversations/v1/service/user.rb +44 -0
  54. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  55. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +442 -0
  56. data/lib/twilio-ruby/rest/conversations/v1/user.rb +35 -0
  57. data/lib/twilio-ruby/rest/conversations/v1.rb +24 -0
  58. data/lib/twilio-ruby/rest/conversations.rb +15 -0
  59. data/lib/twilio-ruby/rest/events/v1/event_type.rb +12 -5
  60. data/lib/twilio-ruby/rest/events/v1/sink.rb +41 -5
  61. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +28 -0
  62. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +55 -34
  63. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
  64. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
  65. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +384 -0
  66. data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
  67. data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
  68. data/lib/twilio-ruby/rest/flex_api.rb +9 -0
  69. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +258 -0
  70. data/lib/twilio-ruby/rest/{fax → frontline_api}/v1.rb +11 -11
  71. data/lib/twilio-ruby/rest/{fax.rb → frontline_api.rb} +11 -11
  72. data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
  73. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  74. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
  75. data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
  76. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  77. data/lib/twilio-ruby/rest/insights/v1.rb +46 -0
  78. data/lib/twilio-ruby/rest/insights.rb +28 -0
  79. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +268 -0
  80. data/lib/twilio-ruby/rest/lookups/v2.rb +45 -0
  81. data/lib/twilio-ruby/rest/lookups.rb +7 -0
  82. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +397 -0
  83. data/lib/twilio-ruby/rest/media/v1/media_recording.rb +406 -0
  84. data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
  85. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +403 -0
  86. data/lib/twilio-ruby/rest/media/v1.rb +76 -0
  87. data/lib/twilio-ruby/rest/media.rb +65 -0
  88. data/lib/twilio-ruby/rest/{fax/v1/fax/fax_media.rb → messaging/v1/brand_registration/brand_vetting.rb} +134 -95
  89. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +127 -2
  90. data/lib/twilio-ruby/rest/messaging/v1/external_campaign.rb +7 -0
  91. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +187 -20
  92. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  93. data/lib/twilio-ruby/rest/messaging/v1/service.rb +37 -5
  94. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +268 -0
  95. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb +188 -0
  96. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +128 -26
  97. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb +7 -0
  98. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  99. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  100. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  101. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  102. data/lib/twilio-ruby/rest/serverless/v1/service/environment.rb +1 -1
  103. data/lib/twilio-ruby/rest/serverless/v1/service.rb +7 -0
  104. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  105. data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +1 -1
  106. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  107. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -55
  108. data/lib/twilio-ruby/rest/supersim/v1/{command.rb → ip_command.rb} +132 -84
  109. data/lib/twilio-ruby/rest/supersim/v1/sim/billing_period.rb +231 -0
  110. data/lib/twilio-ruby/rest/supersim/v1/sim.rb +30 -1
  111. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
  112. data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +23 -9
  113. data/lib/twilio-ruby/rest/supersim/v1.rb +23 -7
  114. data/lib/twilio-ruby/rest/supersim.rb +15 -6
  115. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  116. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +7 -3
  117. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
  118. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +7 -3
  119. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +23 -11
  120. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
  121. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
  122. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -22
  123. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -3
  124. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +155 -10
  125. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +12 -9
  126. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +74 -22
  127. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +34 -15
  128. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +66 -31
  129. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  130. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +25 -7
  131. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  132. data/lib/twilio-ruby/rest/verify/v2/service.rb +40 -11
  133. data/lib/twilio-ruby/rest/verify/v2/template.rb +206 -0
  134. data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
  135. data/lib/twilio-ruby/rest/verify/v2/verification_attempts_summary.rb +234 -0
  136. data/lib/twilio-ruby/rest/verify/v2.rb +14 -0
  137. data/lib/twilio-ruby/rest/verify.rb +14 -2
  138. data/lib/twilio-ruby/rest/video/v1/composition.rb +21 -8
  139. data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +0 -8
  140. data/lib/twilio-ruby/rest/video/v1/recording.rb +21 -0
  141. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  142. data/lib/twilio-ruby/rest/video/v1/room.rb +62 -5
  143. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  144. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  145. data/lib/twilio-ruby/rest/voice.rb +8 -0
  146. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
  147. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
  148. data/lib/twilio-ruby/rest.rb +13 -0
  149. data/lib/twilio-ruby/twiml/voice_response.rb +727 -87
  150. data/lib/twilio-ruby/version.rb +1 -1
  151. data/lib/twilio-ruby.rb +6 -16
  152. data/sonar-project.properties +13 -0
  153. data/twilio-ruby.gemspec +1 -2
  154. metadata +59 -32
  155. data/.travis.yml +0 -45
  156. data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -536
  157. /data/lib/twilio-ruby/framework/{domain.rb → rest/domain.rb} +0 -0
  158. /data/lib/twilio-ruby/framework/{error.rb → rest/error.rb} +0 -0
  159. /data/lib/twilio-ruby/framework/{helper.rb → rest/helper.rb} +0 -0
  160. /data/lib/twilio-ruby/framework/{obsolete_client.rb → rest/obsolete_client.rb} +0 -0
  161. /data/lib/twilio-ruby/framework/{page.rb → rest/page.rb} +0 -0
  162. /data/lib/twilio-ruby/framework/{resource.rb → rest/resource.rb} +0 -0
  163. /data/lib/twilio-ruby/framework/{version.rb → rest/version.rb} +0 -0
@@ -37,13 +37,17 @@ module Twilio
37
37
  # @param [String] webhook_url The URL associated with this Webhook.
38
38
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
39
39
  # One of: `enabled` or `disabled`
40
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
41
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
42
+ # in the future.
40
43
  # @return [WebhookInstance] Created WebhookInstance
41
- def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset)
44
+ def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset, version: :unset)
42
45
  data = Twilio::Values.of({
43
46
  'FriendlyName' => friendly_name,
44
47
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
45
48
  'WebhookUrl' => webhook_url,
46
49
  'Status' => status,
50
+ 'Version' => version,
47
51
  })
48
52
 
49
53
  payload = @version.create('POST', @uri, data: data)
@@ -197,13 +201,17 @@ module Twilio
197
201
  # @param [String] webhook_url The URL associated with this Webhook.
198
202
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
199
203
  # One of: `enabled` or `disabled`
204
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
205
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
206
+ # in the future.
200
207
  # @return [WebhookInstance] Updated WebhookInstance
201
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
208
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
202
209
  data = Twilio::Values.of({
203
210
  'FriendlyName' => friendly_name,
204
211
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
205
212
  'WebhookUrl' => webhook_url,
206
213
  'Status' => status,
214
+ 'Version' => version,
207
215
  })
208
216
 
209
217
  payload = @version.update('POST', @uri, data: data)
@@ -264,6 +272,7 @@ module Twilio
264
272
  'friendly_name' => payload['friendly_name'],
265
273
  'event_types' => payload['event_types'],
266
274
  'status' => payload['status'],
275
+ 'version' => payload['version'],
267
276
  'webhook_url' => payload['webhook_url'],
268
277
  'webhook_method' => payload['webhook_method'],
269
278
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
@@ -323,6 +332,12 @@ module Twilio
323
332
  @properties['status']
324
333
  end
325
334
 
335
+ ##
336
+ # @return [webhook.Version] The webhook version
337
+ def version
338
+ @properties['version']
339
+ end
340
+
326
341
  ##
327
342
  # @return [String] The URL associated with this Webhook.
328
343
  def webhook_url
@@ -336,13 +351,13 @@ module Twilio
336
351
  end
337
352
 
338
353
  ##
339
- # @return [Time] The RFC 2822 date and time in GMT when the resource was created
354
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
340
355
  def date_created
341
356
  @properties['date_created']
342
357
  end
343
358
 
344
359
  ##
345
- # @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
360
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
346
361
  def date_updated
347
362
  @properties['date_updated']
348
363
  end
@@ -363,13 +378,17 @@ module Twilio
363
378
  # @param [String] webhook_url The URL associated with this Webhook.
364
379
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
365
380
  # One of: `enabled` or `disabled`
381
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
382
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
383
+ # in the future.
366
384
  # @return [WebhookInstance] Updated WebhookInstance
367
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
385
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
368
386
  context.update(
369
387
  friendly_name: friendly_name,
370
388
  event_types: event_types,
371
389
  webhook_url: webhook_url,
372
390
  status: status,
391
+ version: version,
373
392
  )
374
393
  end
375
394
 
@@ -48,10 +48,12 @@ module Twilio
48
48
  # a custom code instead of a randomly generated one. Not available for all
49
49
  # customers.
50
50
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
51
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
51
+ # If true, include the date in the Challenge's response. Otherwise, the date is
52
52
  # omitted from the response. See
53
53
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
54
- # parameter for more info. Default: true
54
+ # parameter for more info. Default: false. **Deprecated** do not use this
55
+ # parameter. This timestamp value is the same one as the one found in
56
+ # `date_created`, please use that one instead.
55
57
  # @param [String] push_apn_credential_sid Optional configuration for the Push
56
58
  # factors. Set the APN Credential for this service. This will allow to send push
57
59
  # notifications to iOS devices. See {Credential
@@ -73,8 +75,11 @@ module Twilio
73
75
  # @param [String] totp_skew Optional configuration for the TOTP factors. The
74
76
  # number of time-steps, past and future, that are valid for validation of TOTP
75
77
  # codes. Must be between 0 and 2, inclusive. Defaults to 1
78
+ # @param [String] default_template_sid The default message
79
+ # {template}[https://www.twilio.com/docs/verify/api/templates]. Will be used for
80
+ # all SMS verifications unless explicitly overriden. SMS channel only.
76
81
  # @return [ServiceInstance] Created ServiceInstance
77
- 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset)
82
+ 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset, default_template_sid: :unset)
78
83
  data = Twilio::Values.of({
79
84
  'FriendlyName' => friendly_name,
80
85
  'CodeLength' => code_length,
@@ -92,6 +97,7 @@ module Twilio
92
97
  'Totp.TimeStep' => totp_time_step,
93
98
  'Totp.CodeLength' => totp_code_length,
94
99
  'Totp.Skew' => totp_skew,
100
+ 'DefaultTemplateSid' => default_template_sid,
95
101
  })
96
102
 
97
103
  payload = @version.create('POST', @uri, data: data)
@@ -278,10 +284,11 @@ module Twilio
278
284
  # a custom code instead of a randomly generated one. Not available for all
279
285
  # customers.
280
286
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
281
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
287
+ # If true, include the date in the Challenge's response. Otherwise, the date is
282
288
  # omitted from the response. See
283
289
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
284
- # parameter for more info. Default: true
290
+ # parameter for more info. Default: false. **Deprecated** do not use this
291
+ # parameter.
285
292
  # @param [String] push_apn_credential_sid Optional configuration for the Push
286
293
  # factors. Set the APN Credential for this service. This will allow to send push
287
294
  # notifications to iOS devices. See {Credential
@@ -303,8 +310,11 @@ module Twilio
303
310
  # @param [String] totp_skew Optional configuration for the TOTP factors. The
304
311
  # number of time-steps, past and future, that are valid for validation of TOTP
305
312
  # codes. Must be between 0 and 2, inclusive. Defaults to 1
313
+ # @param [String] default_template_sid The default message
314
+ # {template}[https://www.twilio.com/docs/verify/api/templates]. Will be used for
315
+ # all SMS verifications unless explicitly overriden. SMS channel only.
306
316
  # @return [ServiceInstance] Updated ServiceInstance
307
- 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset)
317
+ 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset, default_template_sid: :unset)
308
318
  data = Twilio::Values.of({
309
319
  'FriendlyName' => friendly_name,
310
320
  'CodeLength' => code_length,
@@ -322,6 +332,7 @@ module Twilio
322
332
  'Totp.TimeStep' => totp_time_step,
323
333
  'Totp.CodeLength' => totp_code_length,
324
334
  'Totp.Skew' => totp_skew,
335
+ 'DefaultTemplateSid' => default_template_sid,
325
336
  })
326
337
 
327
338
  payload = @version.update('POST', @uri, data: data)
@@ -434,8 +445,14 @@ module Twilio
434
445
  ##
435
446
  # Access the access_tokens
436
447
  # @return [AccessTokenList]
437
- # @return [AccessTokenContext]
438
- def access_tokens
448
+ # @return [AccessTokenContext] if sid was passed.
449
+ def access_tokens(sid=:unset)
450
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
451
+
452
+ if sid != :unset
453
+ return AccessTokenContext.new(@version, @solution[:sid], sid, )
454
+ end
455
+
439
456
  unless @access_tokens
440
457
  @access_tokens = AccessTokenList.new(@version, service_sid: @solution[:sid], )
441
458
  end
@@ -484,6 +501,7 @@ module Twilio
484
501
  'custom_code_enabled' => payload['custom_code_enabled'],
485
502
  'push' => payload['push'],
486
503
  'totp' => payload['totp'],
504
+ 'default_template_sid' => payload['default_template_sid'],
487
505
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
488
506
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
489
507
  'url' => payload['url'],
@@ -584,6 +602,12 @@ module Twilio
584
602
  @properties['totp']
585
603
  end
586
604
 
605
+ ##
606
+ # @return [String] The default_template_sid
607
+ def default_template_sid
608
+ @properties['default_template_sid']
609
+ end
610
+
587
611
  ##
588
612
  # @return [Time] The RFC 2822 date and time in GMT when the resource was created
589
613
  def date_created
@@ -645,10 +669,11 @@ module Twilio
645
669
  # a custom code instead of a randomly generated one. Not available for all
646
670
  # customers.
647
671
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
648
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
672
+ # If true, include the date in the Challenge's response. Otherwise, the date is
649
673
  # omitted from the response. See
650
674
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
651
- # parameter for more info. Default: true
675
+ # parameter for more info. Default: false. **Deprecated** do not use this
676
+ # parameter.
652
677
  # @param [String] push_apn_credential_sid Optional configuration for the Push
653
678
  # factors. Set the APN Credential for this service. This will allow to send push
654
679
  # notifications to iOS devices. See {Credential
@@ -670,8 +695,11 @@ module Twilio
670
695
  # @param [String] totp_skew Optional configuration for the TOTP factors. The
671
696
  # number of time-steps, past and future, that are valid for validation of TOTP
672
697
  # codes. Must be between 0 and 2, inclusive. Defaults to 1
698
+ # @param [String] default_template_sid The default message
699
+ # {template}[https://www.twilio.com/docs/verify/api/templates]. Will be used for
700
+ # all SMS verifications unless explicitly overriden. SMS channel only.
673
701
  # @return [ServiceInstance] Updated ServiceInstance
674
- 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset)
702
+ 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, do_not_share_warning_enabled: :unset, custom_code_enabled: :unset, push_include_date: :unset, push_apn_credential_sid: :unset, push_fcm_credential_sid: :unset, totp_issuer: :unset, totp_time_step: :unset, totp_code_length: :unset, totp_skew: :unset, default_template_sid: :unset)
675
703
  context.update(
676
704
  friendly_name: friendly_name,
677
705
  code_length: code_length,
@@ -689,6 +717,7 @@ module Twilio
689
717
  totp_time_step: totp_time_step,
690
718
  totp_code_length: totp_code_length,
691
719
  totp_skew: totp_skew,
720
+ default_template_sid: default_template_sid,
692
721
  )
693
722
  end
694
723
 
@@ -0,0 +1,206 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Verify < Domain
12
+ class V2 < Version
13
+ class TemplateList < ListResource
14
+ ##
15
+ # Initialize the TemplateList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [TemplateList] TemplateList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/Templates"
24
+ end
25
+
26
+ ##
27
+ # Lists TemplateInstance records from the API as a list.
28
+ # Unlike stream(), this operation is eager and will load `limit` records into
29
+ # memory before returning.
30
+ # @param [String] friendly_name String filter used to query templates with a given
31
+ # friendly name
32
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
33
+ # guarantees to never return more than limit. Default is no limit
34
+ # @param [Integer] page_size Number of records to fetch per request, when
35
+ # not set will use the default value of 50 records. If no page_size is defined
36
+ # but a limit is defined, stream() will attempt to read the limit with the most
37
+ # efficient page size, i.e. min(limit, 1000)
38
+ # @return [Array] Array of up to limit results
39
+ def list(friendly_name: :unset, limit: nil, page_size: nil)
40
+ self.stream(friendly_name: friendly_name, limit: limit, page_size: page_size).entries
41
+ end
42
+
43
+ ##
44
+ # Streams TemplateInstance records from the API as an Enumerable.
45
+ # This operation lazily loads records as efficiently as possible until the limit
46
+ # is reached.
47
+ # @param [String] friendly_name String filter used to query templates with a given
48
+ # friendly name
49
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
50
+ # guarantees to never return more than limit. Default is no limit.
51
+ # @param [Integer] page_size Number of records to fetch per request, when
52
+ # not set will use the default value of 50 records. If no page_size is defined
53
+ # but a limit is defined, stream() will attempt to read the limit with the most
54
+ # efficient page size, i.e. min(limit, 1000)
55
+ # @return [Enumerable] Enumerable that will yield up to limit results
56
+ def stream(friendly_name: :unset, limit: nil, page_size: nil)
57
+ limits = @version.read_limits(limit, page_size)
58
+
59
+ page = self.page(friendly_name: friendly_name, page_size: limits[:page_size], )
60
+
61
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
62
+ end
63
+
64
+ ##
65
+ # When passed a block, yields TemplateInstance records from the API.
66
+ # This operation lazily loads records as efficiently as possible until the limit
67
+ # is reached.
68
+ def each
69
+ limits = @version.read_limits
70
+
71
+ page = self.page(page_size: limits[:page_size], )
72
+
73
+ @version.stream(page,
74
+ limit: limits[:limit],
75
+ page_limit: limits[:page_limit]).each {|x| yield x}
76
+ end
77
+
78
+ ##
79
+ # Retrieve a single page of TemplateInstance records from the API.
80
+ # Request is executed immediately.
81
+ # @param [String] friendly_name String filter used to query templates with a given
82
+ # friendly name
83
+ # @param [String] page_token PageToken provided by the API
84
+ # @param [Integer] page_number Page Number, this value is simply for client state
85
+ # @param [Integer] page_size Number of records to return, defaults to 50
86
+ # @return [Page] Page of TemplateInstance
87
+ def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
88
+ params = Twilio::Values.of({
89
+ 'FriendlyName' => friendly_name,
90
+ 'PageToken' => page_token,
91
+ 'Page' => page_number,
92
+ 'PageSize' => page_size,
93
+ })
94
+
95
+ response = @version.page('GET', @uri, params: params)
96
+
97
+ TemplatePage.new(@version, response, @solution)
98
+ end
99
+
100
+ ##
101
+ # Retrieve a single page of TemplateInstance records from the API.
102
+ # Request is executed immediately.
103
+ # @param [String] target_url API-generated URL for the requested results page
104
+ # @return [Page] Page of TemplateInstance
105
+ def get_page(target_url)
106
+ response = @version.domain.request(
107
+ 'GET',
108
+ target_url
109
+ )
110
+ TemplatePage.new(@version, response, @solution)
111
+ end
112
+
113
+ ##
114
+ # Provide a user friendly representation
115
+ def to_s
116
+ '#<Twilio.Verify.V2.TemplateList>'
117
+ end
118
+ end
119
+
120
+ class TemplatePage < Page
121
+ ##
122
+ # Initialize the TemplatePage
123
+ # @param [Version] version Version that contains the resource
124
+ # @param [Response] response Response from the API
125
+ # @param [Hash] solution Path solution for the resource
126
+ # @return [TemplatePage] TemplatePage
127
+ def initialize(version, response, solution)
128
+ super(version, response)
129
+
130
+ # Path Solution
131
+ @solution = solution
132
+ end
133
+
134
+ ##
135
+ # Build an instance of TemplateInstance
136
+ # @param [Hash] payload Payload response from the API
137
+ # @return [TemplateInstance] TemplateInstance
138
+ def get_instance(payload)
139
+ TemplateInstance.new(@version, payload, )
140
+ end
141
+
142
+ ##
143
+ # Provide a user friendly representation
144
+ def to_s
145
+ '<Twilio.Verify.V2.TemplatePage>'
146
+ end
147
+ end
148
+
149
+ class TemplateInstance < InstanceResource
150
+ ##
151
+ # Initialize the TemplateInstance
152
+ # @param [Version] version Version that contains the resource
153
+ # @param [Hash] payload payload that contains response from Twilio
154
+ # @return [TemplateInstance] TemplateInstance
155
+ def initialize(version, payload)
156
+ super(version)
157
+
158
+ # Marshaled Properties
159
+ @properties = {
160
+ 'sid' => payload['sid'],
161
+ 'account_sid' => payload['account_sid'],
162
+ 'friendly_name' => payload['friendly_name'],
163
+ 'translations' => payload['translations'],
164
+ }
165
+ end
166
+
167
+ ##
168
+ # @return [String] A string that uniquely identifies this Template
169
+ def sid
170
+ @properties['sid']
171
+ end
172
+
173
+ ##
174
+ # @return [String] Account Sid
175
+ def account_sid
176
+ @properties['account_sid']
177
+ end
178
+
179
+ ##
180
+ # @return [String] A string to describe the verification template
181
+ def friendly_name
182
+ @properties['friendly_name']
183
+ end
184
+
185
+ ##
186
+ # @return [Hash] Object with the template translations.
187
+ def translations
188
+ @properties['translations']
189
+ end
190
+
191
+ ##
192
+ # Provide a user friendly representation
193
+ def to_s
194
+ "<Twilio.Verify.V2.TemplateInstance>"
195
+ end
196
+
197
+ ##
198
+ # Provide a detailed, user friendly representation
199
+ def inspect
200
+ "<Twilio.Verify.V2.TemplateInstance>"
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
206
+ end
@@ -28,11 +28,24 @@ module Twilio
28
28
  # Unlike stream(), this operation is eager and will load `limit` records into
29
29
  # memory before returning.
30
30
  # @param [Time] date_created_after Datetime filter used to query Verification
31
- # Attempts created after this datetime.
31
+ # Attempts created after this datetime. Given as GMT in RFC 2822 format.
32
32
  # @param [Time] date_created_before Datetime filter used to query Verification
33
- # Attempts created before this datetime.
34
- # @param [String] channel_data_to Destination of a verification. Depending on the
35
- # type of channel, it could be a phone number in E.164 format or an email address.
33
+ # Attempts created before this datetime. Given as GMT in RFC 2822 format.
34
+ # @param [String] channel_data_to Destination of a verification. It is phone
35
+ # number in E.164 format.
36
+ # @param [String] country Filter used to query Verification Attempts sent to the
37
+ # specified destination country.
38
+ # @param [verification_attempt.Channels] channel Filter used to query Verification
39
+ # Attempts by communication channel. Valid values are `SMS` and `CALL`
40
+ # @param [String] verify_service_sid Filter used to query Verification Attempts by
41
+ # verify service. Only attempts of the provided SID will be returned.
42
+ # @param [String] verification_sid Filter used to return all the Verification
43
+ # Attempts of a single verification. Only attempts of the provided verification
44
+ # SID will be returned.
45
+ # @param [verification_attempt.ConversionStatus] status Filter used to query
46
+ # Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for
47
+ # attempts that were not converted, and `CONVERTED`, for attempts that were
48
+ # confirmed.
36
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
37
50
  # guarantees to never return more than limit. Default is no limit
38
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -40,11 +53,16 @@ module Twilio
40
53
  # but a limit is defined, stream() will attempt to read the limit with the most
41
54
  # efficient page size, i.e. min(limit, 1000)
42
55
  # @return [Array] Array of up to limit results
43
- def list(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil)
56
+ def list(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, country: :unset, channel: :unset, verify_service_sid: :unset, verification_sid: :unset, status: :unset, limit: nil, page_size: nil)
44
57
  self.stream(
45
58
  date_created_after: date_created_after,
46
59
  date_created_before: date_created_before,
47
60
  channel_data_to: channel_data_to,
61
+ country: country,
62
+ channel: channel,
63
+ verify_service_sid: verify_service_sid,
64
+ verification_sid: verification_sid,
65
+ status: status,
48
66
  limit: limit,
49
67
  page_size: page_size
50
68
  ).entries
@@ -55,11 +73,24 @@ module Twilio
55
73
  # This operation lazily loads records as efficiently as possible until the limit
56
74
  # is reached.
57
75
  # @param [Time] date_created_after Datetime filter used to query Verification
58
- # Attempts created after this datetime.
76
+ # Attempts created after this datetime. Given as GMT in RFC 2822 format.
59
77
  # @param [Time] date_created_before Datetime filter used to query Verification
60
- # Attempts created before this datetime.
61
- # @param [String] channel_data_to Destination of a verification. Depending on the
62
- # type of channel, it could be a phone number in E.164 format or an email address.
78
+ # Attempts created before this datetime. Given as GMT in RFC 2822 format.
79
+ # @param [String] channel_data_to Destination of a verification. It is phone
80
+ # number in E.164 format.
81
+ # @param [String] country Filter used to query Verification Attempts sent to the
82
+ # specified destination country.
83
+ # @param [verification_attempt.Channels] channel Filter used to query Verification
84
+ # Attempts by communication channel. Valid values are `SMS` and `CALL`
85
+ # @param [String] verify_service_sid Filter used to query Verification Attempts by
86
+ # verify service. Only attempts of the provided SID will be returned.
87
+ # @param [String] verification_sid Filter used to return all the Verification
88
+ # Attempts of a single verification. Only attempts of the provided verification
89
+ # SID will be returned.
90
+ # @param [verification_attempt.ConversionStatus] status Filter used to query
91
+ # Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for
92
+ # attempts that were not converted, and `CONVERTED`, for attempts that were
93
+ # confirmed.
63
94
  # @param [Integer] limit Upper limit for the number of records to return. stream()
64
95
  # guarantees to never return more than limit. Default is no limit.
65
96
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -67,13 +98,18 @@ module Twilio
67
98
  # but a limit is defined, stream() will attempt to read the limit with the most
68
99
  # efficient page size, i.e. min(limit, 1000)
69
100
  # @return [Enumerable] Enumerable that will yield up to limit results
70
- def stream(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, limit: nil, page_size: nil)
101
+ def stream(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, country: :unset, channel: :unset, verify_service_sid: :unset, verification_sid: :unset, status: :unset, limit: nil, page_size: nil)
71
102
  limits = @version.read_limits(limit, page_size)
72
103
 
73
104
  page = self.page(
74
105
  date_created_after: date_created_after,
75
106
  date_created_before: date_created_before,
76
107
  channel_data_to: channel_data_to,
108
+ country: country,
109
+ channel: channel,
110
+ verify_service_sid: verify_service_sid,
111
+ verification_sid: verification_sid,
112
+ status: status,
77
113
  page_size: limits[:page_size],
78
114
  )
79
115
 
@@ -98,20 +134,38 @@ module Twilio
98
134
  # Retrieve a single page of VerificationAttemptInstance records from the API.
99
135
  # Request is executed immediately.
100
136
  # @param [Time] date_created_after Datetime filter used to query Verification
101
- # Attempts created after this datetime.
137
+ # Attempts created after this datetime. Given as GMT in RFC 2822 format.
102
138
  # @param [Time] date_created_before Datetime filter used to query Verification
103
- # Attempts created before this datetime.
104
- # @param [String] channel_data_to Destination of a verification. Depending on the
105
- # type of channel, it could be a phone number in E.164 format or an email address.
139
+ # Attempts created before this datetime. Given as GMT in RFC 2822 format.
140
+ # @param [String] channel_data_to Destination of a verification. It is phone
141
+ # number in E.164 format.
142
+ # @param [String] country Filter used to query Verification Attempts sent to the
143
+ # specified destination country.
144
+ # @param [verification_attempt.Channels] channel Filter used to query Verification
145
+ # Attempts by communication channel. Valid values are `SMS` and `CALL`
146
+ # @param [String] verify_service_sid Filter used to query Verification Attempts by
147
+ # verify service. Only attempts of the provided SID will be returned.
148
+ # @param [String] verification_sid Filter used to return all the Verification
149
+ # Attempts of a single verification. Only attempts of the provided verification
150
+ # SID will be returned.
151
+ # @param [verification_attempt.ConversionStatus] status Filter used to query
152
+ # Verification Attempts by conversion status. Valid values are `UNCONVERTED`, for
153
+ # attempts that were not converted, and `CONVERTED`, for attempts that were
154
+ # confirmed.
106
155
  # @param [String] page_token PageToken provided by the API
107
156
  # @param [Integer] page_number Page Number, this value is simply for client state
108
157
  # @param [Integer] page_size Number of records to return, defaults to 50
109
158
  # @return [Page] Page of VerificationAttemptInstance
110
- def page(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
159
+ def page(date_created_after: :unset, date_created_before: :unset, channel_data_to: :unset, country: :unset, channel: :unset, verify_service_sid: :unset, verification_sid: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
111
160
  params = Twilio::Values.of({
112
161
  'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
113
162
  'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
114
163
  'ChannelData.To' => channel_data_to,
164
+ 'Country' => country,
165
+ 'Channel' => channel,
166
+ 'VerifyServiceSid' => verify_service_sid,
167
+ 'VerificationSid' => verification_sid,
168
+ 'Status' => status,
115
169
  'PageToken' => page_token,
116
170
  'Page' => page_number,
117
171
  'PageSize' => page_size,
@@ -224,10 +278,12 @@ module Twilio
224
278
  'sid' => payload['sid'],
225
279
  'account_sid' => payload['account_sid'],
226
280
  'service_sid' => payload['service_sid'],
281
+ 'verification_sid' => payload['verification_sid'],
227
282
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
228
283
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
229
284
  'conversion_status' => payload['conversion_status'],
230
285
  'channel' => payload['channel'],
286
+ 'price' => payload['price'],
231
287
  'channel_data' => payload['channel_data'],
232
288
  'url' => payload['url'],
233
289
  }
@@ -249,23 +305,29 @@ module Twilio
249
305
  end
250
306
 
251
307
  ##
252
- # @return [String] A string that uniquely identifies this Verification Attempt
308
+ # @return [String] The SID that uniquely identifies the verification attempt.
253
309
  def sid
254
310
  @properties['sid']
255
311
  end
256
312
 
257
313
  ##
258
- # @return [String] Account Sid
314
+ # @return [String] The SID of the Account that created the verification.
259
315
  def account_sid
260
316
  @properties['account_sid']
261
317
  end
262
318
 
263
319
  ##
264
- # @return [String] The service_sid
320
+ # @return [String] The SID of the verify service that generated this attempt.
265
321
  def service_sid
266
322
  @properties['service_sid']
267
323
  end
268
324
 
325
+ ##
326
+ # @return [String] The SID of the verification that generated this attempt.
327
+ def verification_sid
328
+ @properties['verification_sid']
329
+ end
330
+
269
331
  ##
270
332
  # @return [Time] The date this Attempt was created
271
333
  def date_created
@@ -279,19 +341,25 @@ module Twilio
279
341
  end
280
342
 
281
343
  ##
282
- # @return [verification_attempt.ConversionStatus] Status of a conversion
344
+ # @return [verification_attempt.ConversionStatus] Status of the conversion for the verification.
283
345
  def conversion_status
284
346
  @properties['conversion_status']
285
347
  end
286
348
 
287
349
  ##
288
- # @return [verification_attempt.Channels] Channel used for the attempt
350
+ # @return [verification_attempt.Channels] Communication channel used for the attempt.
289
351
  def channel
290
352
  @properties['channel']
291
353
  end
292
354
 
293
355
  ##
294
- # @return [Hash] Object with the channel information for an attempt
356
+ # @return [Hash] An object containing the charge for this verification attempt.
357
+ def price
358
+ @properties['price']
359
+ end
360
+
361
+ ##
362
+ # @return [Hash] An object containing the channel specific information for an attempt.
295
363
  def channel_data
296
364
  @properties['channel_data']
297
365
  end