twilio-ruby 5.20.1 → 5.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +22 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/accounts/v1/credential.rb +4 -4
  5. data/lib/twilio-ruby/rest/accounts/v1/credential/aws.rb +21 -20
  6. data/lib/twilio-ruby/rest/accounts/v1/credential/public_key.rb +21 -19
  7. data/lib/twilio-ruby/rest/api.rb +8 -7
  8. data/lib/twilio-ruby/rest/api/v2010/account/address/dependent_phone_number.rb +32 -28
  9. data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +56 -37
  10. data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +27 -27
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +248 -165
  12. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +35 -35
  13. data/lib/twilio-ruby/rest/api/v2010/account/key.rb +15 -11
  14. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +104 -114
  15. data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +4 -4
  16. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +48 -46
  17. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result.rb +29 -22
  18. data/lib/twilio-ruby/rest/api/v2010/account/recording/add_on_result/payload.rb +36 -28
  19. data/lib/twilio-ruby/rest/api/v2010/account/recording/transcription.rb +35 -21
  20. data/lib/twilio-ruby/rest/api/v2010/account/transcription.rb +24 -20
  21. data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +27 -27
  22. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor.rb +7 -0
  23. data/lib/twilio-ruby/rest/authy/v1/service/entity/factor/challenge.rb +7 -0
  24. data/lib/twilio-ruby/rest/client.rb +8 -7
  25. data/lib/twilio-ruby/rest/fax.rb +2 -1
  26. data/lib/twilio-ruby/rest/fax/v1.rb +2 -1
  27. data/lib/twilio-ruby/rest/fax/v1/fax.rb +85 -75
  28. data/lib/twilio-ruby/rest/fax/v1/fax/fax_media.rb +16 -16
  29. data/lib/twilio-ruby/rest/verify/v1/service.rb +8 -2
  30. data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +120 -3
  31. data/lib/twilio-ruby/rest/video/v1/composition.rb +1 -1
  32. data/lib/twilio-ruby/version.rb +1 -1
  33. data/spec/integration/authy/v1/service/entity/factor/challenge_spec.rb +5 -0
  34. data/spec/integration/authy/v1/service/entity/factor_spec.rb +4 -0
  35. data/spec/integration/verify/v1/service/verification_spec.rb +107 -1
  36. data/spec/integration/video/v1/composition_spec.rb +28 -3
  37. metadata +2 -2
@@ -29,7 +29,8 @@ module Twilio
29
29
  end
30
30
 
31
31
  ##
32
- # @param [String] sid A 34 character string that uniquely identifies this fax.
32
+ # @param [String] sid The unique string that we created to identify the Fax
33
+ # resource.
33
34
  # @return [Twilio::REST::Fax::V1::FaxInstance] if sid was passed.
34
35
  # @return [Twilio::REST::Fax::V1::FaxList]
35
36
  def faxes(sid=:unset)
@@ -19,7 +19,8 @@ module Twilio
19
19
  end
20
20
 
21
21
  ##
22
- # @param [String] sid A 34 character string that uniquely identifies this fax.
22
+ # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
23
+ # resource to fetch.
23
24
  # @return [Twilio::REST::Fax::V1::FaxContext] if sid was passed.
24
25
  # @return [Twilio::REST::Fax::V1::FaxList]
25
26
  def faxes(sid=:unset)
@@ -29,14 +29,16 @@ module Twilio
29
29
  # Lists FaxInstance records from the API as a list.
30
30
  # Unlike stream(), this operation is eager and will load `limit` records into
31
31
  # memory before returning.
32
- # @param [String] from Filters the returned list to only include faxes sent from
33
- # the supplied number, given in E.164 format.
34
- # @param [String] to Filters the returned list to only include faxes sent to the
35
- # supplied number, given in E.164 format.
36
- # @param [Time] date_created_on_or_before Filters the returned list to only
37
- # include faxes created on or before the supplied date, given in ISO 8601 format.
38
- # @param [Time] date_created_after Filters the returned list to only include faxes
39
- # created after the supplied date, given in ISO 8601 format.
32
+ # @param [String] from Retrieve only those faxes sent from this phone number,
33
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
34
+ # @param [String] to Retrieve only those faxes sent to this phone number,
35
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
36
+ # @param [Time] date_created_on_or_before Retrieve only those faxes with a
37
+ # `date_created` that is before or equal to this value, specified in [ISO
38
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
39
+ # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
40
+ # that is later than this value, specified in [ISO
41
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
40
42
  # @param [Integer] limit Upper limit for the number of records to return. stream()
41
43
  # guarantees to never return more than limit. Default is no limit
42
44
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -59,14 +61,16 @@ module Twilio
59
61
  # Streams FaxInstance records from the API as an Enumerable.
60
62
  # This operation lazily loads records as efficiently as possible until the limit
61
63
  # is reached.
62
- # @param [String] from Filters the returned list to only include faxes sent from
63
- # the supplied number, given in E.164 format.
64
- # @param [String] to Filters the returned list to only include faxes sent to the
65
- # supplied number, given in E.164 format.
66
- # @param [Time] date_created_on_or_before Filters the returned list to only
67
- # include faxes created on or before the supplied date, given in ISO 8601 format.
68
- # @param [Time] date_created_after Filters the returned list to only include faxes
69
- # created after the supplied date, given in ISO 8601 format.
64
+ # @param [String] from Retrieve only those faxes sent from this phone number,
65
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
66
+ # @param [String] to Retrieve only those faxes sent to this phone number,
67
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
68
+ # @param [Time] date_created_on_or_before Retrieve only those faxes with a
69
+ # `date_created` that is before or equal to this value, specified in [ISO
70
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
71
+ # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
72
+ # that is later than this value, specified in [ISO
73
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
70
74
  # @param [Integer] limit Upper limit for the number of records to return. stream()
71
75
  # guarantees to never return more than limit. Default is no limit.
72
76
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -105,14 +109,16 @@ module Twilio
105
109
  ##
106
110
  # Retrieve a single page of FaxInstance records from the API.
107
111
  # Request is executed immediately.
108
- # @param [String] from Filters the returned list to only include faxes sent from
109
- # the supplied number, given in E.164 format.
110
- # @param [String] to Filters the returned list to only include faxes sent to the
111
- # supplied number, given in E.164 format.
112
- # @param [Time] date_created_on_or_before Filters the returned list to only
113
- # include faxes created on or before the supplied date, given in ISO 8601 format.
114
- # @param [Time] date_created_after Filters the returned list to only include faxes
115
- # created after the supplied date, given in ISO 8601 format.
112
+ # @param [String] from Retrieve only those faxes sent from this phone number,
113
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
114
+ # @param [String] to Retrieve only those faxes sent to this phone number,
115
+ # specified in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.
116
+ # @param [Time] date_created_on_or_before Retrieve only those faxes with a
117
+ # `date_created` that is before or equal to this value, specified in [ISO
118
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
119
+ # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
120
+ # that is later than this value, specified in [ISO
121
+ # 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
116
122
  # @param [String] page_token PageToken provided by the API
117
123
  # @param [Integer] page_number Page Number, this value is simply for client state
118
124
  # @param [Integer] page_size Number of records to return, defaults to 50
@@ -151,31 +157,35 @@ module Twilio
151
157
  ##
152
158
  # Retrieve a single page of FaxInstance records from the API.
153
159
  # Request is executed immediately.
154
- # @param [String] to The phone number or SIP address to send the fax to,
155
- # E.164-formatted.
156
- # @param [String] media_url The HTTP or HTTPS URL where the fax media PDF resides
157
- # that Twilio will make a GET request to. (See our
158
- # [security](https://www.twilio.com/docs/security) page for information on how to
159
- # ensure the request for your media comes from Twilio)
160
- # @param [fax.Quality] quality A [quality
161
- # value](https://www.twilio.com/docs/api/fax/rest/faxes#fax-quality-values), which
162
- # defaults to `fine`
163
- # @param [String] status_callback A [status
164
- # callback](https://www.twilio.com/docs/api/fax/rest/faxes#fax-status-callback)
165
- # URL that will receive a POST when the status of the fax changes
166
- # @param [String] from The phone number to use as the caller id, E.164-formatted.
167
- # If using a phone number, it must be a Twilio number or a verified outgoing
168
- # caller id for your account. If sending to a SIP address, this can be any
169
- # alphanumeric string (plus the characters `+`, `_`, `.`, and `-`) to use in the
170
- # From header of the SIP request.
171
- # @param [String] sip_auth_username The username to use for authentication when
172
- # sending to a SIP address.
173
- # @param [String] sip_auth_password The password to use for authentication when
174
- # sending to a SIP address.
175
- # @param [Boolean] store_media Whether or not to store a copy of the sent media on
176
- # Twilio's servers for later retrieval (defaults to `true`)
177
- # @param [String] ttl How many minutes from when a fax was initiated should Twilio
178
- # attempt to send a fax.
160
+ # @param [String] to The phone number to receive the fax in
161
+ # [E.164](https://www.twilio.com/docs/glossary/what-e164) format or the
162
+ # recipient's SIP URI.
163
+ # @param [String] media_url The Twilio-hosted URL of the PDF that contains the
164
+ # fax. See our [security](https://www.twilio.com/docs/security) page for
165
+ # information on how to ensure the request for your media comes from Twilio.
166
+ # @param [fax.Quality] quality The [Fax Quality
167
+ # value](https://www.twilio.com/docs/api/fax/rest/faxes#fax-quality-values) that
168
+ # describes the fax quality. Can be: `standard`, `fine`, or `superfine` and
169
+ # defaults to `fine`.
170
+ # @param [String] status_callback The URL we should call using the `POST` method
171
+ # to send status information to your application when the status of the fax
172
+ # changes.
173
+ # @param [String] from The number the fax was sent from. Can be the phone number
174
+ # in [E.164](https://www.twilio.com/docs/glossary/what-e164) format or the SIP
175
+ # `from` value. The caller ID displayed to the recipient uses this value. If this
176
+ # is a phone number, it must be a Twilio number or a verified outgoing caller id
177
+ # from your account. If `to` is a SIP address, this can be any alphanumeric string
178
+ # (and also the characters `+`, `_`, `.`, and `-`), which will be used in the
179
+ # `from` header of the SIP request.
180
+ # @param [String] sip_auth_username The username to use with the
181
+ # `sip_auth_password` to authenticate faxes sent to a SIP address.
182
+ # @param [String] sip_auth_password The password to use with `sip_auth_username`
183
+ # to authenticate faxes sent to a SIP address.
184
+ # @param [Boolean] store_media Whether to store a copy of the sent media on our
185
+ # servers for later retrieval. Can be: `true` or `false` and the default is
186
+ # `true`.
187
+ # @param [String] ttl How long in minutes from when the fax is initiated that we
188
+ # should try to send the fax.
179
189
  # @return [FaxInstance] Newly created FaxInstance
180
190
  def create(to: nil, media_url: nil, quality: :unset, status_callback: :unset, from: :unset, sip_auth_username: :unset, sip_auth_password: :unset, store_media: :unset, ttl: :unset)
181
191
  data = Twilio::Values.of({
@@ -243,7 +253,8 @@ module Twilio
243
253
  ##
244
254
  # Initialize the FaxContext
245
255
  # @param [Version] version Version that contains the resource
246
- # @param [String] sid A 34 character string that uniquely identifies this fax.
256
+ # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
257
+ # resource to fetch.
247
258
  # @return [FaxContext] FaxContext
248
259
  def initialize(version, sid)
249
260
  super(version)
@@ -273,9 +284,8 @@ module Twilio
273
284
 
274
285
  ##
275
286
  # Update the FaxInstance
276
- # @param [fax.UpdateStatus] status The updated status of this fax. The only valid
277
- # option is `canceled`. This may fail if the status has already started
278
- # transmission.
287
+ # @param [fax.UpdateStatus] status The new status of the resource. Can be only
288
+ # `canceled`. This may fail if transmission has already started.
279
289
  # @return [FaxInstance] Updated FaxInstance
280
290
  def update(status: :unset)
281
291
  data = Twilio::Values.of({'Status' => status, })
@@ -336,7 +346,8 @@ module Twilio
336
346
  # Initialize the FaxInstance
337
347
  # @param [Version] version Version that contains the resource
338
348
  # @param [Hash] payload payload that contains response from Twilio
339
- # @param [String] sid A 34 character string that uniquely identifies this fax.
349
+ # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
350
+ # resource to fetch.
340
351
  # @return [FaxInstance] FaxInstance
341
352
  def initialize(version, payload, sid: nil)
342
353
  super(version)
@@ -380,109 +391,109 @@ module Twilio
380
391
  end
381
392
 
382
393
  ##
383
- # @return [String] A string that uniquely identifies this fax.
394
+ # @return [String] The unique string that identifies the resource
384
395
  def sid
385
396
  @properties['sid']
386
397
  end
387
398
 
388
399
  ##
389
- # @return [String] Account SID
400
+ # @return [String] The SID of the Account that created the resource
390
401
  def account_sid
391
402
  @properties['account_sid']
392
403
  end
393
404
 
394
405
  ##
395
- # @return [String] The party that sent the fax
406
+ # @return [String] The number the fax was sent from
396
407
  def from
397
408
  @properties['from']
398
409
  end
399
410
 
400
411
  ##
401
- # @return [String] The party that received the fax
412
+ # @return [String] The phone number that received the fax
402
413
  def to
403
414
  @properties['to']
404
415
  end
405
416
 
406
417
  ##
407
- # @return [fax.Quality] The quality of this fax
418
+ # @return [fax.Quality] The quality of the fax
408
419
  def quality
409
420
  @properties['quality']
410
421
  end
411
422
 
412
423
  ##
413
- # @return [String] Media SID
424
+ # @return [String] The SID of the FaxMedia resource that is associated with the Fax
414
425
  def media_sid
415
426
  @properties['media_sid']
416
427
  end
417
428
 
418
429
  ##
419
- # @return [String] URL pointing to fax media
430
+ # @return [String] The Twilio-hosted URL that can be used to download fax media
420
431
  def media_url
421
432
  @properties['media_url']
422
433
  end
423
434
 
424
435
  ##
425
- # @return [String] Number of pages
436
+ # @return [String] The number of pages contained in the fax document
426
437
  def num_pages
427
438
  @properties['num_pages']
428
439
  end
429
440
 
430
441
  ##
431
- # @return [String] The time taken to transmit the fax
442
+ # @return [String] The time it took to transmit the fax
432
443
  def duration
433
444
  @properties['duration']
434
445
  end
435
446
 
436
447
  ##
437
- # @return [fax.Status] The status of this fax
448
+ # @return [fax.Status] The status of the fax
438
449
  def status
439
450
  @properties['status']
440
451
  end
441
452
 
442
453
  ##
443
- # @return [fax.Direction] The direction of this fax
454
+ # @return [fax.Direction] The direction of the fax
444
455
  def direction
445
456
  @properties['direction']
446
457
  end
447
458
 
448
459
  ##
449
- # @return [String] The API version used
460
+ # @return [String] The API version used to transmit the fax
450
461
  def api_version
451
462
  @properties['api_version']
452
463
  end
453
464
 
454
465
  ##
455
- # @return [String] Fax transmission price
466
+ # @return [String] The fax transmission price
456
467
  def price
457
468
  @properties['price']
458
469
  end
459
470
 
460
471
  ##
461
- # @return [String] Currency used for billing
472
+ # @return [String] The ISO 4217 currency used for billing
462
473
  def price_unit
463
474
  @properties['price_unit']
464
475
  end
465
476
 
466
477
  ##
467
- # @return [Time] The date this fax was created
478
+ # @return [Time] The ISO 8601 formatted date and time in GMT when the resource was created
468
479
  def date_created
469
480
  @properties['date_created']
470
481
  end
471
482
 
472
483
  ##
473
- # @return [Time] The date this fax was updated
484
+ # @return [Time] The ISO 8601 formatted date and time in GMT when the resource was last updated
474
485
  def date_updated
475
486
  @properties['date_updated']
476
487
  end
477
488
 
478
489
  ##
479
- # @return [String] Nested resource URLs
490
+ # @return [String] The URLs of the fax's related resources
480
491
  def links
481
492
  @properties['links']
482
493
  end
483
494
 
484
495
  ##
485
- # @return [String] The URL of this resource
496
+ # @return [String] The absolute URL of the fax resource
486
497
  def url
487
498
  @properties['url']
488
499
  end
@@ -496,9 +507,8 @@ module Twilio
496
507
 
497
508
  ##
498
509
  # Update the FaxInstance
499
- # @param [fax.UpdateStatus] status The updated status of this fax. The only valid
500
- # option is `canceled`. This may fail if the status has already started
501
- # transmission.
510
+ # @param [fax.UpdateStatus] status The new status of the resource. Can be only
511
+ # `canceled`. This may fail if transmission has already started.
502
512
  # @return [FaxInstance] Updated FaxInstance
503
513
  def update(status: :unset)
504
514
  context.update(status: status, )
@@ -17,8 +17,8 @@ module Twilio
17
17
  ##
18
18
  # Initialize the FaxMediaList
19
19
  # @param [Version] version Version that contains the resource
20
- # @param [String] fax_sid The unique SID identifier of the fax for which this
21
- # media is associated.
20
+ # @param [String] fax_sid The SID of the fax the FaxMedia resource is associated
21
+ # with.
22
22
  # @return [FaxMediaList] FaxMediaList
23
23
  def initialize(version, fax_sid: nil)
24
24
  super(version)
@@ -154,9 +154,9 @@ module Twilio
154
154
  ##
155
155
  # Initialize the FaxMediaContext
156
156
  # @param [Version] version Version that contains the resource
157
- # @param [String] fax_sid The unique SID identifier of the fax.
158
- # @param [String] sid A 34 character string that uniquely identifies this fax
159
- # media.
157
+ # @param [String] fax_sid The SID of the fax with the FaxMedia resource to fetch.
158
+ # @param [String] sid The Twilio-provided string that uniquely identifies the
159
+ # FaxMedia resource to fetch.
160
160
  # @return [FaxMediaContext] FaxMediaContext
161
161
  def initialize(version, fax_sid, sid)
162
162
  super(version)
@@ -210,10 +210,10 @@ module Twilio
210
210
  # Initialize the FaxMediaInstance
211
211
  # @param [Version] version Version that contains the resource
212
212
  # @param [Hash] payload payload that contains response from Twilio
213
- # @param [String] fax_sid The unique SID identifier of the fax for which this
214
- # media is associated.
215
- # @param [String] sid A 34 character string that uniquely identifies this fax
216
- # media.
213
+ # @param [String] fax_sid The SID of the fax the FaxMedia resource is associated
214
+ # with.
215
+ # @param [String] sid The Twilio-provided string that uniquely identifies the
216
+ # FaxMedia resource to fetch.
217
217
  # @return [FaxMediaInstance] FaxMediaInstance
218
218
  def initialize(version, payload, fax_sid: nil, sid: nil)
219
219
  super(version)
@@ -246,43 +246,43 @@ module Twilio
246
246
  end
247
247
 
248
248
  ##
249
- # @return [String] A string that uniquely identifies this fax media
249
+ # @return [String] The unique string that identifies the resource
250
250
  def sid
251
251
  @properties['sid']
252
252
  end
253
253
 
254
254
  ##
255
- # @return [String] Account SID
255
+ # @return [String] The SID of the Account that created the resource
256
256
  def account_sid
257
257
  @properties['account_sid']
258
258
  end
259
259
 
260
260
  ##
261
- # @return [String] Fax SID
261
+ # @return [String] The SID of the fax the FaxMedia resource is associated with
262
262
  def fax_sid
263
263
  @properties['fax_sid']
264
264
  end
265
265
 
266
266
  ##
267
- # @return [String] Media content type
267
+ # @return [String] The content type of the stored fax media
268
268
  def content_type
269
269
  @properties['content_type']
270
270
  end
271
271
 
272
272
  ##
273
- # @return [Time] The date this fax media was created
273
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
274
274
  def date_created
275
275
  @properties['date_created']
276
276
  end
277
277
 
278
278
  ##
279
- # @return [Time] The date this fax media was updated
279
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
280
280
  def date_updated
281
281
  @properties['date_updated']
282
282
  end
283
283
 
284
284
  ##
285
- # @return [String] The URL of this resource
285
+ # @return [String] The absolute URL of the FaxMedia resource
286
286
  def url
287
287
  @properties['url']
288
288
  end
@@ -265,8 +265,14 @@ module Twilio
265
265
  ##
266
266
  # Access the verifications
267
267
  # @return [VerificationList]
268
- # @return [VerificationContext]
269
- def verifications
268
+ # @return [VerificationContext] if sid was passed.
269
+ def verifications(sid=:unset)
270
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
271
+
272
+ if sid != :unset
273
+ return VerificationContext.new(@version, @solution[:sid], sid, )
274
+ end
275
+
270
276
  unless @verifications
271
277
  @verifications = VerificationList.new(@version, service_sid: @solution[:sid], )
272
278
  end
@@ -106,6 +106,81 @@ module Twilio
106
106
  end
107
107
  end
108
108
 
109
+ ##
110
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
111
+ class VerificationContext < InstanceContext
112
+ ##
113
+ # Initialize the VerificationContext
114
+ # @param [Version] version Version that contains the resource
115
+ # @param [String] service_sid The unique SID identifier of the Service.
116
+ # @param [String] sid A 34 character string that uniquely identifies this
117
+ # Verification or the associated phone number.
118
+ # @return [VerificationContext] VerificationContext
119
+ def initialize(version, service_sid, sid)
120
+ super(version)
121
+
122
+ # Path Solution
123
+ @solution = {service_sid: service_sid, sid: sid, }
124
+ @uri = "/Services/#{@solution[:service_sid]}/Verifications/#{@solution[:sid]}"
125
+ end
126
+
127
+ ##
128
+ # Update the VerificationInstance
129
+ # @param [verification.Status] status New status to set for the Verification, only
130
+ # canceled is allowed at the moment.
131
+ # @return [VerificationInstance] Updated VerificationInstance
132
+ def update(status: nil)
133
+ data = Twilio::Values.of({'Status' => status, })
134
+
135
+ payload = @version.update(
136
+ 'POST',
137
+ @uri,
138
+ data: data,
139
+ )
140
+
141
+ VerificationInstance.new(
142
+ @version,
143
+ payload,
144
+ service_sid: @solution[:service_sid],
145
+ sid: @solution[:sid],
146
+ )
147
+ end
148
+
149
+ ##
150
+ # Fetch a VerificationInstance
151
+ # @return [VerificationInstance] Fetched VerificationInstance
152
+ def fetch
153
+ params = Twilio::Values.of({})
154
+
155
+ payload = @version.fetch(
156
+ 'GET',
157
+ @uri,
158
+ params,
159
+ )
160
+
161
+ VerificationInstance.new(
162
+ @version,
163
+ payload,
164
+ service_sid: @solution[:service_sid],
165
+ sid: @solution[:sid],
166
+ )
167
+ end
168
+
169
+ ##
170
+ # Provide a user friendly representation
171
+ def to_s
172
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
173
+ "#<Twilio.Verify.V1.VerificationContext #{context}>"
174
+ end
175
+
176
+ ##
177
+ # Provide a detailed, user friendly representation
178
+ def inspect
179
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
180
+ "#<Twilio.Verify.V1.VerificationContext #{context}>"
181
+ end
182
+ end
183
+
109
184
  ##
110
185
  # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
111
186
  class VerificationInstance < InstanceResource
@@ -114,8 +189,10 @@ module Twilio
114
189
  # @param [Version] version Version that contains the resource
115
190
  # @param [Hash] payload payload that contains response from Twilio
116
191
  # @param [String] service_sid The unique SID identifier of the Service.
192
+ # @param [String] sid A 34 character string that uniquely identifies this
193
+ # Verification or the associated phone number.
117
194
  # @return [VerificationInstance] VerificationInstance
118
- def initialize(version, payload, service_sid: nil)
195
+ def initialize(version, payload, service_sid: nil, sid: nil)
119
196
  super(version)
120
197
 
121
198
  # Marshaled Properties
@@ -132,7 +209,23 @@ module Twilio
132
209
  'payee' => payload['payee'],
133
210
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
134
211
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
212
+ 'url' => payload['url'],
135
213
  }
214
+
215
+ # Context
216
+ @instance_context = nil
217
+ @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
218
+ end
219
+
220
+ ##
221
+ # Generate an instance context for the instance, the context is capable of
222
+ # performing various actions. All instance actions are proxied to the context
223
+ # @return [VerificationContext] VerificationContext for this VerificationInstance
224
+ def context
225
+ unless @instance_context
226
+ @instance_context = VerificationContext.new(@version, @params['service_sid'], @params['sid'], )
227
+ end
228
+ @instance_context
136
229
  end
137
230
 
138
231
  ##
@@ -207,16 +300,40 @@ module Twilio
207
300
  @properties['date_updated']
208
301
  end
209
302
 
303
+ ##
304
+ # @return [String] The URL of this resource.
305
+ def url
306
+ @properties['url']
307
+ end
308
+
309
+ ##
310
+ # Update the VerificationInstance
311
+ # @param [verification.Status] status New status to set for the Verification, only
312
+ # canceled is allowed at the moment.
313
+ # @return [VerificationInstance] Updated VerificationInstance
314
+ def update(status: nil)
315
+ context.update(status: status, )
316
+ end
317
+
318
+ ##
319
+ # Fetch a VerificationInstance
320
+ # @return [VerificationInstance] Fetched VerificationInstance
321
+ def fetch
322
+ context.fetch
323
+ end
324
+
210
325
  ##
211
326
  # Provide a user friendly representation
212
327
  def to_s
213
- "<Twilio.Verify.V1.VerificationInstance>"
328
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
329
+ "<Twilio.Verify.V1.VerificationInstance #{values}>"
214
330
  end
215
331
 
216
332
  ##
217
333
  # Provide a detailed, user friendly representation
218
334
  def inspect
219
- "<Twilio.Verify.V1.VerificationInstance>"
335
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
336
+ "<Twilio.Verify.V1.VerificationInstance #{values}>"
220
337
  end
221
338
  end
222
339
  end