twilio-ruby 5.63.0 → 5.65.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/test-and-deploy.yml +27 -3
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +84 -21
- data/CHANGES.md +79 -0
- data/Makefile +1 -4
- data/README.md +3 -2
- data/lib/rack/twilio_webhook_authentication.rb +25 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/siprec.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +674 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +26 -0
- data/lib/twilio-ruby/rest/conversations/v1/address_configuration.rb +447 -0
- data/lib/twilio-ruby/rest/conversations/v1.rb +17 -0
- data/lib/twilio-ruby/rest/conversations.rb +9 -0
- data/lib/twilio-ruby/rest/fax/v1/fax.rb +0 -77
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +33 -18
- data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +474 -0
- data/lib/twilio-ruby/rest/insights/v1/conference.rb +512 -0
- data/lib/twilio-ruby/rest/insights/v1.rb +16 -0
- data/lib/twilio-ruby/rest/insights.rb +8 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +7 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +75 -18
- data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +71 -30
- data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +1 -1
- data/lib/twilio-ruby/rest/supersim/v1/usage_record.rb +9 -9
- data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
- data/lib/twilio-ruby/rest/supersim.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +130 -8
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +7 -0
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +16 -6
- data/lib/twilio-ruby/rest/verify/v2/service.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/template.rb +1 -1
- data/lib/twilio-ruby/rest/verify/v2/verification_attempt.rb +89 -21
- data/lib/twilio-ruby/rest/verify.rb +2 -2
- data/lib/twilio-ruby/rest/video/v1/room.rb +7 -4
- data/lib/twilio-ruby/version.rb +1 -1
- data/sonar-project.properties +1 -1
- data/twilio-ruby.gemspec +0 -1
- metadata +7 -16
@@ -39,16 +39,23 @@ module Twilio
|
|
39
39
|
# in Megabytes that each Sim resource assigned to the Fleet resource can consume
|
40
40
|
# during a billing period (normally one month). Value must be between 1MB (1) and
|
41
41
|
# 2TB (2,000,000). Defaults to 1GB (1,000).
|
42
|
-
# @param [Boolean] commands_enabled
|
43
|
-
#
|
44
|
-
# `true`.
|
45
|
-
# @param [String] commands_url
|
46
|
-
# SIM in the Fleet is used to send an SMS
|
47
|
-
# Your server should respond with an HTTP
|
48
|
-
# response body will be ignored.
|
49
|
-
# @param [String] commands_method
|
50
|
-
#
|
51
|
-
# to `POST`.
|
42
|
+
# @param [Boolean] commands_enabled Deprecated. Use `sms_commands_enabled`
|
43
|
+
# instead. Defines whether SIMs in the Fleet are capable of sending and receiving
|
44
|
+
# machine-to-machine SMS via Commands. Defaults to `true`.
|
45
|
+
# @param [String] commands_url Deprecated. Use `sms_commands_url` instead. The URL
|
46
|
+
# that will receive a webhook when a Super SIM in the Fleet is used to send an SMS
|
47
|
+
# from your device to the Commands number. Your server should respond with an HTTP
|
48
|
+
# status code in the 200 range; any response body will be ignored.
|
49
|
+
# @param [String] commands_method Deprecated. Use `sms_commands_method` instead. A
|
50
|
+
# string representing the HTTP method to use when making a request to
|
51
|
+
# `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
|
52
|
+
# @param [String] ip_commands_url The URL that will receive a webhook when a Super
|
53
|
+
# SIM in the Fleet is used to send an IP Command from your device to a special IP
|
54
|
+
# address. Your server should respond with an HTTP status code in the 200 range;
|
55
|
+
# any response body will be ignored.
|
56
|
+
# @param [String] ip_commands_method A string representing the HTTP method to use
|
57
|
+
# when making a request to `ip_commands_url`. Can be one of `POST` or `GET`.
|
58
|
+
# Defaults to `POST`.
|
52
59
|
# @param [Boolean] sms_commands_enabled Defines whether SIMs in the Fleet are
|
53
60
|
# capable of sending and receiving machine-to-machine SMS via Commands. Defaults
|
54
61
|
# to `true`.
|
@@ -60,7 +67,7 @@ module Twilio
|
|
60
67
|
# when making a request to `sms_commands_url`. Can be one of `POST` or `GET`.
|
61
68
|
# Defaults to `POST`.
|
62
69
|
# @return [FleetInstance] Created FleetInstance
|
63
|
-
def create(network_access_profile: nil, unique_name: :unset, data_enabled: :unset, data_limit: :unset, commands_enabled: :unset, commands_url: :unset, commands_method: :unset, sms_commands_enabled: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
70
|
+
def create(network_access_profile: nil, unique_name: :unset, data_enabled: :unset, data_limit: :unset, commands_enabled: :unset, commands_url: :unset, commands_method: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_enabled: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
64
71
|
data = Twilio::Values.of({
|
65
72
|
'NetworkAccessProfile' => network_access_profile,
|
66
73
|
'UniqueName' => unique_name,
|
@@ -69,6 +76,8 @@ module Twilio
|
|
69
76
|
'CommandsEnabled' => commands_enabled,
|
70
77
|
'CommandsUrl' => commands_url,
|
71
78
|
'CommandsMethod' => commands_method,
|
79
|
+
'IpCommandsUrl' => ip_commands_url,
|
80
|
+
'IpCommandsMethod' => ip_commands_method,
|
72
81
|
'SmsCommandsEnabled' => sms_commands_enabled,
|
73
82
|
'SmsCommandsUrl' => sms_commands_url,
|
74
83
|
'SmsCommandsMethod' => sms_commands_method,
|
@@ -244,13 +253,20 @@ module Twilio
|
|
244
253
|
# @param [String] network_access_profile The SID or unique name of the Network
|
245
254
|
# Access Profile that will control which cellular networks the Fleet's SIMs can
|
246
255
|
# connect to.
|
247
|
-
# @param [String] commands_url
|
248
|
-
# SIM in the Fleet is used to send an SMS
|
249
|
-
# Your server should respond with an HTTP
|
250
|
-
# response body will be ignored.
|
251
|
-
# @param [String] commands_method
|
252
|
-
#
|
253
|
-
# to `POST`.
|
256
|
+
# @param [String] commands_url Deprecated. Use `sms_commands_url` instead. The URL
|
257
|
+
# that will receive a webhook when a Super SIM in the Fleet is used to send an SMS
|
258
|
+
# from your device to the Commands number. Your server should respond with an HTTP
|
259
|
+
# status code in the 200 range; any response body will be ignored.
|
260
|
+
# @param [String] commands_method Deprecated. Use `sms_commands_method` instead. A
|
261
|
+
# string representing the HTTP method to use when making a request to
|
262
|
+
# `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
|
263
|
+
# @param [String] ip_commands_url The URL that will receive a webhook when a Super
|
264
|
+
# SIM in the Fleet is used to send an IP Command from your device to a special IP
|
265
|
+
# address. Your server should respond with an HTTP status code in the 200 range;
|
266
|
+
# any response body will be ignored.
|
267
|
+
# @param [String] ip_commands_method A string representing the HTTP method to use
|
268
|
+
# when making a request to `ip_commands_url`. Can be one of `POST` or `GET`.
|
269
|
+
# Defaults to `POST`.
|
254
270
|
# @param [String] sms_commands_url The URL that will receive a webhook when a
|
255
271
|
# Super SIM in the Fleet is used to send an SMS from your device to the SMS
|
256
272
|
# Commands number. Your server should respond with an HTTP status code in the 200
|
@@ -259,12 +275,14 @@ module Twilio
|
|
259
275
|
# when making a request to `sms_commands_url`. Can be one of `POST` or `GET`.
|
260
276
|
# Defaults to `POST`.
|
261
277
|
# @return [FleetInstance] Updated FleetInstance
|
262
|
-
def update(unique_name: :unset, network_access_profile: :unset, commands_url: :unset, commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
278
|
+
def update(unique_name: :unset, network_access_profile: :unset, commands_url: :unset, commands_method: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
263
279
|
data = Twilio::Values.of({
|
264
280
|
'UniqueName' => unique_name,
|
265
281
|
'NetworkAccessProfile' => network_access_profile,
|
266
282
|
'CommandsUrl' => commands_url,
|
267
283
|
'CommandsMethod' => commands_method,
|
284
|
+
'IpCommandsUrl' => ip_commands_url,
|
285
|
+
'IpCommandsMethod' => ip_commands_method,
|
268
286
|
'SmsCommandsUrl' => sms_commands_url,
|
269
287
|
'SmsCommandsMethod' => sms_commands_method,
|
270
288
|
})
|
@@ -319,6 +337,8 @@ module Twilio
|
|
319
337
|
'sms_commands_url' => payload['sms_commands_url'],
|
320
338
|
'sms_commands_method' => payload['sms_commands_method'],
|
321
339
|
'network_access_profile_sid' => payload['network_access_profile_sid'],
|
340
|
+
'ip_commands_url' => payload['ip_commands_url'],
|
341
|
+
'ip_commands_method' => payload['ip_commands_method'],
|
322
342
|
}
|
323
343
|
|
324
344
|
# Context
|
@@ -392,19 +412,19 @@ module Twilio
|
|
392
412
|
end
|
393
413
|
|
394
414
|
##
|
395
|
-
# @return [Boolean]
|
415
|
+
# @return [Boolean] Deprecated
|
396
416
|
def commands_enabled
|
397
417
|
@properties['commands_enabled']
|
398
418
|
end
|
399
419
|
|
400
420
|
##
|
401
|
-
# @return [String]
|
421
|
+
# @return [String] Deprecated
|
402
422
|
def commands_url
|
403
423
|
@properties['commands_url']
|
404
424
|
end
|
405
425
|
|
406
426
|
##
|
407
|
-
# @return [String]
|
427
|
+
# @return [String] Deprecated
|
408
428
|
def commands_method
|
409
429
|
@properties['commands_method']
|
410
430
|
end
|
@@ -433,6 +453,18 @@ module Twilio
|
|
433
453
|
@properties['network_access_profile_sid']
|
434
454
|
end
|
435
455
|
|
456
|
+
##
|
457
|
+
# @return [String] The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device
|
458
|
+
def ip_commands_url
|
459
|
+
@properties['ip_commands_url']
|
460
|
+
end
|
461
|
+
|
462
|
+
##
|
463
|
+
# @return [String] A string representing the HTTP method to use when making a request to `ip_commands_url`
|
464
|
+
def ip_commands_method
|
465
|
+
@properties['ip_commands_method']
|
466
|
+
end
|
467
|
+
|
436
468
|
##
|
437
469
|
# Fetch the FleetInstance
|
438
470
|
# @return [FleetInstance] Fetched FleetInstance
|
@@ -448,13 +480,20 @@ module Twilio
|
|
448
480
|
# @param [String] network_access_profile The SID or unique name of the Network
|
449
481
|
# Access Profile that will control which cellular networks the Fleet's SIMs can
|
450
482
|
# connect to.
|
451
|
-
# @param [String] commands_url
|
452
|
-
# SIM in the Fleet is used to send an SMS
|
453
|
-
# Your server should respond with an HTTP
|
454
|
-
# response body will be ignored.
|
455
|
-
# @param [String] commands_method
|
456
|
-
#
|
457
|
-
# to `POST`.
|
483
|
+
# @param [String] commands_url Deprecated. Use `sms_commands_url` instead. The URL
|
484
|
+
# that will receive a webhook when a Super SIM in the Fleet is used to send an SMS
|
485
|
+
# from your device to the Commands number. Your server should respond with an HTTP
|
486
|
+
# status code in the 200 range; any response body will be ignored.
|
487
|
+
# @param [String] commands_method Deprecated. Use `sms_commands_method` instead. A
|
488
|
+
# string representing the HTTP method to use when making a request to
|
489
|
+
# `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
|
490
|
+
# @param [String] ip_commands_url The URL that will receive a webhook when a Super
|
491
|
+
# SIM in the Fleet is used to send an IP Command from your device to a special IP
|
492
|
+
# address. Your server should respond with an HTTP status code in the 200 range;
|
493
|
+
# any response body will be ignored.
|
494
|
+
# @param [String] ip_commands_method A string representing the HTTP method to use
|
495
|
+
# when making a request to `ip_commands_url`. Can be one of `POST` or `GET`.
|
496
|
+
# Defaults to `POST`.
|
458
497
|
# @param [String] sms_commands_url The URL that will receive a webhook when a
|
459
498
|
# Super SIM in the Fleet is used to send an SMS from your device to the SMS
|
460
499
|
# Commands number. Your server should respond with an HTTP status code in the 200
|
@@ -463,12 +502,14 @@ module Twilio
|
|
463
502
|
# when making a request to `sms_commands_url`. Can be one of `POST` or `GET`.
|
464
503
|
# Defaults to `POST`.
|
465
504
|
# @return [FleetInstance] Updated FleetInstance
|
466
|
-
def update(unique_name: :unset, network_access_profile: :unset, commands_url: :unset, commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
505
|
+
def update(unique_name: :unset, network_access_profile: :unset, commands_url: :unset, commands_method: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
|
467
506
|
context.update(
|
468
507
|
unique_name: unique_name,
|
469
508
|
network_access_profile: network_access_profile,
|
470
509
|
commands_url: commands_url,
|
471
510
|
commands_method: commands_method,
|
511
|
+
ip_commands_url: ip_commands_url,
|
512
|
+
ip_commands_method: ip_commands_method,
|
472
513
|
sms_commands_url: sms_commands_url,
|
473
514
|
sms_commands_method: sms_commands_method,
|
474
515
|
)
|
@@ -28,7 +28,7 @@ module Twilio
|
|
28
28
|
##
|
29
29
|
# Create the SmsCommandInstance
|
30
30
|
# @param [String] sim The `sid` or `unique_name` of the
|
31
|
-
# {SIM}[https://www.twilio.com/docs/
|
31
|
+
# {SIM}[https://www.twilio.com/docs/iot/supersim/api/sim-resource] to send the SMS
|
32
32
|
# Command to.
|
33
33
|
# @param [String] payload The message body of the SMS Command.
|
34
34
|
# @param [String] callback_method The HTTP method we should use to call
|
@@ -49,9 +49,9 @@ module Twilio
|
|
49
49
|
# @param [Time] start_time Only include usage that occurred at or after this time,
|
50
50
|
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Default
|
51
51
|
# is one month before the `end_time`.
|
52
|
-
# @param [Time] end_time Only include usage that occurred before this time
|
53
|
-
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
54
|
-
# is the current time.
|
52
|
+
# @param [Time] end_time Only include usage that occurred before this time
|
53
|
+
# (exclusive), specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
54
|
+
# format. Default is the current time.
|
55
55
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
56
56
|
# guarantees to never return more than limit. Default is no limit
|
57
57
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -98,9 +98,9 @@ module Twilio
|
|
98
98
|
# @param [Time] start_time Only include usage that occurred at or after this time,
|
99
99
|
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Default
|
100
100
|
# is one month before the `end_time`.
|
101
|
-
# @param [Time] end_time Only include usage that occurred before this time
|
102
|
-
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
103
|
-
# is the current time.
|
101
|
+
# @param [Time] end_time Only include usage that occurred before this time
|
102
|
+
# (exclusive), specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
103
|
+
# format. Default is the current time.
|
104
104
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
105
105
|
# guarantees to never return more than limit. Default is no limit.
|
106
106
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -163,9 +163,9 @@ module Twilio
|
|
163
163
|
# @param [Time] start_time Only include usage that occurred at or after this time,
|
164
164
|
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format. Default
|
165
165
|
# is one month before the `end_time`.
|
166
|
-
# @param [Time] end_time Only include usage that occurred before this time
|
167
|
-
# specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
168
|
-
# is the current time.
|
166
|
+
# @param [Time] end_time Only include usage that occurred before this time
|
167
|
+
# (exclusive), specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601]
|
168
|
+
# format. Default is the current time.
|
169
169
|
# @param [String] page_token PageToken provided by the API
|
170
170
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
171
171
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
@@ -16,6 +16,7 @@ module Twilio
|
|
16
16
|
super
|
17
17
|
@version = 'v1'
|
18
18
|
@commands = nil
|
19
|
+
@esim_profiles = nil
|
19
20
|
@fleets = nil
|
20
21
|
@ip_commands = nil
|
21
22
|
@networks = nil
|
@@ -40,6 +41,21 @@ module Twilio
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
44
|
+
##
|
45
|
+
# @param [String] sid The SID of the eSIM Profile resource to fetch.
|
46
|
+
# @return [Twilio::REST::Supersim::V1::EsimProfileContext] if sid was passed.
|
47
|
+
# @return [Twilio::REST::Supersim::V1::EsimProfileList]
|
48
|
+
def esim_profiles(sid=:unset)
|
49
|
+
if sid.nil?
|
50
|
+
raise ArgumentError, 'sid cannot be nil'
|
51
|
+
end
|
52
|
+
if sid == :unset
|
53
|
+
@esim_profiles ||= EsimProfileList.new self
|
54
|
+
else
|
55
|
+
EsimProfileContext.new(self, sid)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
43
59
|
##
|
44
60
|
# @param [String] sid The SID of the Fleet resource to fetch.
|
45
61
|
# @return [Twilio::REST::Supersim::V1::FleetContext] if sid was passed.
|
@@ -37,6 +37,15 @@ module Twilio
|
|
37
37
|
self.v1.commands(sid)
|
38
38
|
end
|
39
39
|
|
40
|
+
##
|
41
|
+
# @param [String] sid The unique string that we created to identify the eSIM
|
42
|
+
# Profile resource.
|
43
|
+
# @return [Twilio::REST::Supersim::V1::EsimProfileInstance] if sid was passed.
|
44
|
+
# @return [Twilio::REST::Supersim::V1::EsimProfileList]
|
45
|
+
def esim_profiles(sid=:unset)
|
46
|
+
self.v1.esim_profiles(sid)
|
47
|
+
end
|
48
|
+
|
40
49
|
##
|
41
50
|
# @param [String] sid The unique string that we created to identify the Fleet
|
42
51
|
# resource.
|
@@ -17,8 +17,7 @@ module Twilio
|
|
17
17
|
##
|
18
18
|
# Initialize the AccessTokenList
|
19
19
|
# @param [Version] version Version that contains the resource
|
20
|
-
# @param [String] service_sid The unique
|
21
|
-
# Service resource.
|
20
|
+
# @param [String] service_sid The unique SID identifier of the Verify Service.
|
22
21
|
# @return [AccessTokenList] AccessTokenList
|
23
22
|
def initialize(version, service_sid: nil)
|
24
23
|
super(version)
|
@@ -88,6 +87,53 @@ module Twilio
|
|
88
87
|
end
|
89
88
|
end
|
90
89
|
|
90
|
+
##
|
91
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
92
|
+
class AccessTokenContext < InstanceContext
|
93
|
+
##
|
94
|
+
# Initialize the AccessTokenContext
|
95
|
+
# @param [Version] version Version that contains the resource
|
96
|
+
# @param [String] service_sid The unique SID identifier of the Service.
|
97
|
+
# @param [String] sid A 34 character string that uniquely identifies this Access
|
98
|
+
# Token.
|
99
|
+
# @return [AccessTokenContext] AccessTokenContext
|
100
|
+
def initialize(version, service_sid, sid)
|
101
|
+
super(version)
|
102
|
+
|
103
|
+
# Path Solution
|
104
|
+
@solution = {service_sid: service_sid, sid: sid, }
|
105
|
+
@uri = "/Services/#{@solution[:service_sid]}/AccessTokens/#{@solution[:sid]}"
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Fetch the AccessTokenInstance
|
110
|
+
# @return [AccessTokenInstance] Fetched AccessTokenInstance
|
111
|
+
def fetch
|
112
|
+
payload = @version.fetch('GET', @uri)
|
113
|
+
|
114
|
+
AccessTokenInstance.new(
|
115
|
+
@version,
|
116
|
+
payload,
|
117
|
+
service_sid: @solution[:service_sid],
|
118
|
+
sid: @solution[:sid],
|
119
|
+
)
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Provide a user friendly representation
|
124
|
+
def to_s
|
125
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
126
|
+
"#<Twilio.Verify.V2.AccessTokenContext #{context}>"
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Provide a detailed, user friendly representation
|
131
|
+
def inspect
|
132
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
133
|
+
"#<Twilio.Verify.V2.AccessTokenContext #{context}>"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
91
137
|
##
|
92
138
|
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
93
139
|
class AccessTokenInstance < InstanceResource
|
@@ -95,14 +141,75 @@ module Twilio
|
|
95
141
|
# Initialize the AccessTokenInstance
|
96
142
|
# @param [Version] version Version that contains the resource
|
97
143
|
# @param [Hash] payload payload that contains response from Twilio
|
98
|
-
# @param [String] service_sid The unique
|
99
|
-
#
|
144
|
+
# @param [String] service_sid The unique SID identifier of the Verify Service.
|
145
|
+
# @param [String] sid A 34 character string that uniquely identifies this Access
|
146
|
+
# Token.
|
100
147
|
# @return [AccessTokenInstance] AccessTokenInstance
|
101
|
-
def initialize(version, payload, service_sid: nil)
|
148
|
+
def initialize(version, payload, service_sid: nil, sid: nil)
|
102
149
|
super(version)
|
103
150
|
|
104
151
|
# Marshaled Properties
|
105
|
-
@properties = {
|
152
|
+
@properties = {
|
153
|
+
'sid' => payload['sid'],
|
154
|
+
'account_sid' => payload['account_sid'],
|
155
|
+
'service_sid' => payload['service_sid'],
|
156
|
+
'entity_identity' => payload['entity_identity'],
|
157
|
+
'factor_type' => payload['factor_type'],
|
158
|
+
'factor_friendly_name' => payload['factor_friendly_name'],
|
159
|
+
'token' => payload['token'],
|
160
|
+
'url' => payload['url'],
|
161
|
+
}
|
162
|
+
|
163
|
+
# Context
|
164
|
+
@instance_context = nil
|
165
|
+
@params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# Generate an instance context for the instance, the context is capable of
|
170
|
+
# performing various actions. All instance actions are proxied to the context
|
171
|
+
# @return [AccessTokenContext] AccessTokenContext for this AccessTokenInstance
|
172
|
+
def context
|
173
|
+
unless @instance_context
|
174
|
+
@instance_context = AccessTokenContext.new(@version, @params['service_sid'], @params['sid'], )
|
175
|
+
end
|
176
|
+
@instance_context
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# @return [String] A string that uniquely identifies this Access Token.
|
181
|
+
def sid
|
182
|
+
@properties['sid']
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# @return [String] Account Sid.
|
187
|
+
def account_sid
|
188
|
+
@properties['account_sid']
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# @return [String] Verify Service Sid.
|
193
|
+
def service_sid
|
194
|
+
@properties['service_sid']
|
195
|
+
end
|
196
|
+
|
197
|
+
##
|
198
|
+
# @return [String] Unique external identifier of the Entity
|
199
|
+
def entity_identity
|
200
|
+
@properties['entity_identity']
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @return [access_token.FactorTypes] The Type of the Factor
|
205
|
+
def factor_type
|
206
|
+
@properties['factor_type']
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# @return [String] A human readable description of this factor.
|
211
|
+
def factor_friendly_name
|
212
|
+
@properties['factor_friendly_name']
|
106
213
|
end
|
107
214
|
|
108
215
|
##
|
@@ -111,16 +218,31 @@ module Twilio
|
|
111
218
|
@properties['token']
|
112
219
|
end
|
113
220
|
|
221
|
+
##
|
222
|
+
# @return [String] The URL of this resource.
|
223
|
+
def url
|
224
|
+
@properties['url']
|
225
|
+
end
|
226
|
+
|
227
|
+
##
|
228
|
+
# Fetch the AccessTokenInstance
|
229
|
+
# @return [AccessTokenInstance] Fetched AccessTokenInstance
|
230
|
+
def fetch
|
231
|
+
context.fetch
|
232
|
+
end
|
233
|
+
|
114
234
|
##
|
115
235
|
# Provide a user friendly representation
|
116
236
|
def to_s
|
117
|
-
"
|
237
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
238
|
+
"<Twilio.Verify.V2.AccessTokenInstance #{values}>"
|
118
239
|
end
|
119
240
|
|
120
241
|
##
|
121
242
|
# Provide a detailed, user friendly representation
|
122
243
|
def inspect
|
123
|
-
"
|
244
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
245
|
+
"<Twilio.Verify.V2.AccessTokenInstance #{values}>"
|
124
246
|
end
|
125
247
|
end
|
126
248
|
end
|
@@ -293,6 +293,7 @@ module Twilio
|
|
293
293
|
'status' => payload['status'],
|
294
294
|
'factor_type' => payload['factor_type'],
|
295
295
|
'config' => payload['config'],
|
296
|
+
'metadata' => payload['metadata'],
|
296
297
|
'url' => payload['url'],
|
297
298
|
}
|
298
299
|
|
@@ -383,6 +384,12 @@ module Twilio
|
|
383
384
|
@properties['config']
|
384
385
|
end
|
385
386
|
|
387
|
+
##
|
388
|
+
# @return [Hash] Metadata of the factor.
|
389
|
+
def metadata
|
390
|
+
@properties['metadata']
|
391
|
+
end
|
392
|
+
|
386
393
|
##
|
387
394
|
# @return [String] The URL of this resource.
|
388
395
|
def url
|
@@ -41,9 +41,7 @@ module Twilio
|
|
41
41
|
# constructing the `binding.uri` property.
|
42
42
|
# At the same time, we recommend avoiding providing PII.
|
43
43
|
# @param [new_factor.FactorTypes] factor_type The Type of this Factor. Currently
|
44
|
-
# `push` and `totp` are supported.
|
45
|
-
# sales}[https://www.twilio.com/help/sales] first to have the Verify TOTP feature
|
46
|
-
# enabled for your Twilio account.
|
44
|
+
# `push` and `totp` are supported.
|
47
45
|
# @param [String] binding_alg The algorithm used when `factor_type` is `push`.
|
48
46
|
# Algorithm supported: `ES256`
|
49
47
|
# @param [String] binding_public_key The Ecdsa public key in PKIX, ASN.1 DER
|
@@ -96,8 +94,12 @@ module Twilio
|
|
96
94
|
# TOTP codes. Can be `sha1`, `sha256` or `sha512`. Defaults to `sha1`.
|
97
95
|
#
|
98
96
|
# Used when `factor_type` is `totp`
|
97
|
+
# @param [Hash] metadata Custom metadata associated with the factor. This is added
|
98
|
+
# by the Device/SDK directly to allow for the inclusion of device information. It
|
99
|
+
# must be a stringified JSON with only strings values eg. `{"os": "Android"}`. Can
|
100
|
+
# be up to 1024 characters in length.
|
99
101
|
# @return [NewFactorInstance] Created NewFactorInstance
|
100
|
-
def create(friendly_name: nil, factor_type: nil, binding_alg: :unset, binding_public_key: :unset, config_app_id: :unset, config_notification_platform: :unset, config_notification_token: :unset, config_sdk_version: :unset, binding_secret: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset)
|
102
|
+
def create(friendly_name: nil, factor_type: nil, binding_alg: :unset, binding_public_key: :unset, config_app_id: :unset, config_notification_platform: :unset, config_notification_token: :unset, config_sdk_version: :unset, binding_secret: :unset, config_time_step: :unset, config_skew: :unset, config_code_length: :unset, config_alg: :unset, metadata: :unset)
|
101
103
|
data = Twilio::Values.of({
|
102
104
|
'FriendlyName' => friendly_name,
|
103
105
|
'FactorType' => factor_type,
|
@@ -112,6 +114,7 @@ module Twilio
|
|
112
114
|
'Config.Skew' => config_skew,
|
113
115
|
'Config.CodeLength' => config_code_length,
|
114
116
|
'Config.Alg' => config_alg,
|
117
|
+
'Metadata' => Twilio.serialize_object(metadata),
|
115
118
|
})
|
116
119
|
|
117
120
|
payload = @version.create('POST', @uri, data: data)
|
@@ -197,6 +200,7 @@ module Twilio
|
|
197
200
|
'status' => payload['status'],
|
198
201
|
'factor_type' => payload['factor_type'],
|
199
202
|
'config' => payload['config'],
|
203
|
+
'metadata' => payload['metadata'],
|
200
204
|
'url' => payload['url'],
|
201
205
|
}
|
202
206
|
end
|
@@ -232,7 +236,7 @@ module Twilio
|
|
232
236
|
end
|
233
237
|
|
234
238
|
##
|
235
|
-
# @return [Hash]
|
239
|
+
# @return [Hash] Binding of the factor
|
236
240
|
def binding
|
237
241
|
@properties['binding']
|
238
242
|
end
|
@@ -268,11 +272,17 @@ module Twilio
|
|
268
272
|
end
|
269
273
|
|
270
274
|
##
|
271
|
-
# @return [Hash]
|
275
|
+
# @return [Hash] Configurations for a `factor_type`.
|
272
276
|
def config
|
273
277
|
@properties['config']
|
274
278
|
end
|
275
279
|
|
280
|
+
##
|
281
|
+
# @return [Hash] Metadata of the factor.
|
282
|
+
def metadata
|
283
|
+
@properties['metadata']
|
284
|
+
end
|
285
|
+
|
276
286
|
##
|
277
287
|
# @return [String] The URL of this resource.
|
278
288
|
def url
|
@@ -442,8 +442,14 @@ module Twilio
|
|
442
442
|
##
|
443
443
|
# Access the access_tokens
|
444
444
|
# @return [AccessTokenList]
|
445
|
-
# @return [AccessTokenContext]
|
446
|
-
def access_tokens
|
445
|
+
# @return [AccessTokenContext] if sid was passed.
|
446
|
+
def access_tokens(sid=:unset)
|
447
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
448
|
+
|
449
|
+
if sid != :unset
|
450
|
+
return AccessTokenContext.new(@version, @solution[:sid], sid, )
|
451
|
+
end
|
452
|
+
|
447
453
|
unless @access_tokens
|
448
454
|
@access_tokens = AccessTokenList.new(@version, service_sid: @solution[:sid], )
|
449
455
|
end
|