twilio-ruby 5.34.0 → 5.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +32 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
- data/lib/twilio-ruby/rest/autopilot.rb +6 -0
- data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +26 -0
- data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +324 -0
- data/lib/twilio-ruby/rest/supersim.rb +8 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +15 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -10
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +337 -0
- data/lib/twilio-ruby/rest/verify/v2/service.rb +22 -3
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
- data/lib/twilio-ruby/rest/voice.rb +36 -0
- data/lib/twilio-ruby/rest/voice/v1.rb +64 -0
- data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +513 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +379 -0
- data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +458 -0
- data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +366 -0
- data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +346 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/sip/domain_spec.rb +12 -4
- data/spec/integration/api/v2010/account/token_spec.rb +23 -11
- data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
- data/spec/integration/numbers/v2/regulatory_compliance/bundle/evaluation_spec.rb +623 -0
- data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +4 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +8 -4
- data/spec/integration/supersim/v1/network_access_profile_spec.rb +208 -0
- data/spec/integration/verify/v2/service_spec.rb +4 -0
- data/spec/integration/voice/v1/byoc_trunk_spec.rb +250 -0
- data/spec/integration/voice/v1/connection_policy/connection_policy_target_spec.rb +246 -0
- data/spec/integration/voice/v1/connection_policy_spec.rb +226 -0
- data/spec/integration/voice/v1/ip_record_spec.rb +223 -0
- data/spec/integration/voice/v1/source_ip_mapping_spec.rb +219 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +28 -3
@@ -45,8 +45,11 @@ module Twilio
|
|
45
45
|
# at the end of an SMS verification body. Disabled by default and applies only to
|
46
46
|
# SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share
|
47
47
|
# this code with anyone; our employees will never ask for the code`
|
48
|
+
# @param [Boolean] custom_code_enabled Whether to allow sending verifications with
|
49
|
+
# a custom code instead of a randomly generated one. Not available for all
|
50
|
+
# customers.
|
48
51
|
# @return [ServiceInstance] Newly created ServiceInstance
|
49
|
-
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)
|
52
|
+
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)
|
50
53
|
data = Twilio::Values.of({
|
51
54
|
'FriendlyName' => friendly_name,
|
52
55
|
'CodeLength' => code_length,
|
@@ -56,6 +59,7 @@ module Twilio
|
|
56
59
|
'TtsName' => tts_name,
|
57
60
|
'Psd2Enabled' => psd2_enabled,
|
58
61
|
'DoNotShareWarningEnabled' => do_not_share_warning_enabled,
|
62
|
+
'CustomCodeEnabled' => custom_code_enabled,
|
59
63
|
})
|
60
64
|
|
61
65
|
payload = @version.create(
|
@@ -247,8 +251,11 @@ module Twilio
|
|
247
251
|
# starting a verification.
|
248
252
|
# @param [Boolean] do_not_share_warning_enabled Whether to add a privacy warning
|
249
253
|
# at the end of an SMS. **Disabled by default and applies only for SMS.**
|
254
|
+
# @param [Boolean] custom_code_enabled Whether to allow sending verifications with
|
255
|
+
# a custom code instead of a randomly generated one. Not available for all
|
256
|
+
# customers.
|
250
257
|
# @return [ServiceInstance] Updated ServiceInstance
|
251
|
-
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)
|
258
|
+
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)
|
252
259
|
data = Twilio::Values.of({
|
253
260
|
'FriendlyName' => friendly_name,
|
254
261
|
'CodeLength' => code_length,
|
@@ -258,6 +265,7 @@ module Twilio
|
|
258
265
|
'TtsName' => tts_name,
|
259
266
|
'Psd2Enabled' => psd2_enabled,
|
260
267
|
'DoNotShareWarningEnabled' => do_not_share_warning_enabled,
|
268
|
+
'CustomCodeEnabled' => custom_code_enabled,
|
261
269
|
})
|
262
270
|
|
263
271
|
payload = @version.update(
|
@@ -373,6 +381,7 @@ module Twilio
|
|
373
381
|
'dtmf_input_required' => payload['dtmf_input_required'],
|
374
382
|
'tts_name' => payload['tts_name'],
|
375
383
|
'do_not_share_warning_enabled' => payload['do_not_share_warning_enabled'],
|
384
|
+
'custom_code_enabled' => payload['custom_code_enabled'],
|
376
385
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
377
386
|
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
378
387
|
'url' => payload['url'],
|
@@ -455,6 +464,12 @@ module Twilio
|
|
455
464
|
@properties['do_not_share_warning_enabled']
|
456
465
|
end
|
457
466
|
|
467
|
+
##
|
468
|
+
# @return [Boolean] Whether to allow sending verifications with a custom code.
|
469
|
+
def custom_code_enabled
|
470
|
+
@properties['custom_code_enabled']
|
471
|
+
end
|
472
|
+
|
458
473
|
##
|
459
474
|
# @return [Time] The RFC 2822 date and time in GMT when the resource was created
|
460
475
|
def date_created
|
@@ -512,8 +527,11 @@ module Twilio
|
|
512
527
|
# starting a verification.
|
513
528
|
# @param [Boolean] do_not_share_warning_enabled Whether to add a privacy warning
|
514
529
|
# at the end of an SMS. **Disabled by default and applies only for SMS.**
|
530
|
+
# @param [Boolean] custom_code_enabled Whether to allow sending verifications with
|
531
|
+
# a custom code instead of a randomly generated one. Not available for all
|
532
|
+
# customers.
|
515
533
|
# @return [ServiceInstance] Updated ServiceInstance
|
516
|
-
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)
|
534
|
+
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)
|
517
535
|
context.update(
|
518
536
|
friendly_name: friendly_name,
|
519
537
|
code_length: code_length,
|
@@ -523,6 +541,7 @@ module Twilio
|
|
523
541
|
tts_name: tts_name,
|
524
542
|
psd2_enabled: psd2_enabled,
|
525
543
|
do_not_share_warning_enabled: do_not_share_warning_enabled,
|
544
|
+
custom_code_enabled: custom_code_enabled,
|
526
545
|
)
|
527
546
|
end
|
528
547
|
|
@@ -42,9 +42,9 @@ module Twilio
|
|
42
42
|
# Voice documentation of
|
43
43
|
# [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits).
|
44
44
|
# @param [String] locale The locale to use for the verification SMS or call. Can
|
45
|
-
# be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `es`, `fi`, `fr`,
|
46
|
-
# `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`,
|
47
|
-
# `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or `zh-HK.`
|
45
|
+
# be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `en-GB`, `es`, `fi`, `fr`,
|
46
|
+
# `he`, `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`,
|
47
|
+
# `pr-BR`, `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or `zh-HK.`
|
48
48
|
# @param [String] custom_code A pre-generated code to use for verification. The
|
49
49
|
# code can be between 4 and 10 characters, inclusive.
|
50
50
|
# @param [String] amount The amount of the associated PSD2 compliant transaction.
|
@@ -28,12 +28,48 @@ module Twilio
|
|
28
28
|
@v1 ||= V1.new self
|
29
29
|
end
|
30
30
|
|
31
|
+
##
|
32
|
+
# @param [String] sid The unique string that that we created to identify the BYOC
|
33
|
+
# Trunk resource.
|
34
|
+
# @return [Twilio::REST::Voice::V1::ByocTrunkInstance] if sid was passed.
|
35
|
+
# @return [Twilio::REST::Voice::V1::ByocTrunkList]
|
36
|
+
def byoc_trunks(sid=:unset)
|
37
|
+
self.v1.byoc_trunks(sid)
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# @param [String] sid The unique string that we created to identify the Connection
|
42
|
+
# Policy resource.
|
43
|
+
# @return [Twilio::REST::Voice::V1::ConnectionPolicyInstance] if sid was passed.
|
44
|
+
# @return [Twilio::REST::Voice::V1::ConnectionPolicyList]
|
45
|
+
def connection_policies(sid=:unset)
|
46
|
+
self.v1.connection_policies(sid)
|
47
|
+
end
|
48
|
+
|
31
49
|
##
|
32
50
|
# @return [Twilio::REST::Voice::V1::DialingPermissionsInstance]
|
33
51
|
def dialing_permissions
|
34
52
|
self.v1.dialing_permissions()
|
35
53
|
end
|
36
54
|
|
55
|
+
##
|
56
|
+
# @param [String] sid The unique string that we created to identify the IP Record
|
57
|
+
# resource.
|
58
|
+
# @return [Twilio::REST::Voice::V1::IpRecordInstance] if sid was passed.
|
59
|
+
# @return [Twilio::REST::Voice::V1::IpRecordList]
|
60
|
+
def ip_records(sid=:unset)
|
61
|
+
self.v1.ip_records(sid)
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# @param [String] sid The unique string that we created to identify the IP Record
|
66
|
+
# resource.
|
67
|
+
# @return [Twilio::REST::Voice::V1::SourceIpMappingInstance] if sid was passed.
|
68
|
+
# @return [Twilio::REST::Voice::V1::SourceIpMappingList]
|
69
|
+
def source_ip_mappings(sid=:unset)
|
70
|
+
self.v1.source_ip_mappings(sid)
|
71
|
+
end
|
72
|
+
|
37
73
|
##
|
38
74
|
# Provide a user friendly representation
|
39
75
|
def to_s
|
@@ -15,7 +15,41 @@ module Twilio
|
|
15
15
|
def initialize(domain)
|
16
16
|
super
|
17
17
|
@version = 'v1'
|
18
|
+
@byoc_trunks = nil
|
19
|
+
@connection_policies = nil
|
18
20
|
@dialing_permissions = nil
|
21
|
+
@ip_records = nil
|
22
|
+
@source_ip_mappings = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the BYOC
|
27
|
+
# Trunk resource to fetch.
|
28
|
+
# @return [Twilio::REST::Voice::V1::ByocTrunkContext] if sid was passed.
|
29
|
+
# @return [Twilio::REST::Voice::V1::ByocTrunkList]
|
30
|
+
def byoc_trunks(sid=:unset)
|
31
|
+
if sid.nil?
|
32
|
+
raise ArgumentError, 'sid cannot be nil'
|
33
|
+
elsif sid == :unset
|
34
|
+
@byoc_trunks ||= ByocTrunkList.new self
|
35
|
+
else
|
36
|
+
ByocTrunkContext.new(self, sid)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
##
|
41
|
+
# @param [String] sid The unique string that we created to identify the Connection
|
42
|
+
# Policy resource to fetch.
|
43
|
+
# @return [Twilio::REST::Voice::V1::ConnectionPolicyContext] if sid was passed.
|
44
|
+
# @return [Twilio::REST::Voice::V1::ConnectionPolicyList]
|
45
|
+
def connection_policies(sid=:unset)
|
46
|
+
if sid.nil?
|
47
|
+
raise ArgumentError, 'sid cannot be nil'
|
48
|
+
elsif sid == :unset
|
49
|
+
@connection_policies ||= ConnectionPolicyList.new self
|
50
|
+
else
|
51
|
+
ConnectionPolicyContext.new(self, sid)
|
52
|
+
end
|
19
53
|
end
|
20
54
|
|
21
55
|
##
|
@@ -24,6 +58,36 @@ module Twilio
|
|
24
58
|
@dialing_permissions ||= DialingPermissionsList.new self
|
25
59
|
end
|
26
60
|
|
61
|
+
##
|
62
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the IP
|
63
|
+
# Record resource to fetch.
|
64
|
+
# @return [Twilio::REST::Voice::V1::IpRecordContext] if sid was passed.
|
65
|
+
# @return [Twilio::REST::Voice::V1::IpRecordList]
|
66
|
+
def ip_records(sid=:unset)
|
67
|
+
if sid.nil?
|
68
|
+
raise ArgumentError, 'sid cannot be nil'
|
69
|
+
elsif sid == :unset
|
70
|
+
@ip_records ||= IpRecordList.new self
|
71
|
+
else
|
72
|
+
IpRecordContext.new(self, sid)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the IP
|
78
|
+
# Record resource to fetch.
|
79
|
+
# @return [Twilio::REST::Voice::V1::SourceIpMappingContext] if sid was passed.
|
80
|
+
# @return [Twilio::REST::Voice::V1::SourceIpMappingList]
|
81
|
+
def source_ip_mappings(sid=:unset)
|
82
|
+
if sid.nil?
|
83
|
+
raise ArgumentError, 'sid cannot be nil'
|
84
|
+
elsif sid == :unset
|
85
|
+
@source_ip_mappings ||= SourceIpMappingList.new self
|
86
|
+
else
|
87
|
+
SourceIpMappingContext.new(self, sid)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
27
91
|
##
|
28
92
|
# Provide a user friendly representation
|
29
93
|
def to_s
|
@@ -0,0 +1,513 @@
|
|
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 Voice < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class ByocTrunkList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the ByocTrunkList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [ByocTrunkList] ByocTrunkList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/ByocTrunks"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Retrieve a single page of ByocTrunkInstance records from the API.
|
28
|
+
# Request is executed immediately.
|
29
|
+
# @param [String] friendly_name A descriptive string that you create to describe
|
30
|
+
# the resource. It is not unique and can be up to 255 characters long.
|
31
|
+
# @param [String] voice_url The URL we should call when the BYOC Trunk receives a
|
32
|
+
# call.
|
33
|
+
# @param [String] voice_method The HTTP method we should use to call `voice_url`.
|
34
|
+
# Can be: `GET` or `POST`.
|
35
|
+
# @param [String] voice_fallback_url The URL that we should call when an error
|
36
|
+
# occurs while retrieving or executing the TwiML from `voice_url`.
|
37
|
+
# @param [String] voice_fallback_method The HTTP method we should use to call
|
38
|
+
# `voice_fallback_url`. Can be: `GET` or `POST`.
|
39
|
+
# @param [String] status_callback_url The URL that we should call to pass status
|
40
|
+
# parameters (such as call ended) to your application.
|
41
|
+
# @param [String] status_callback_method The HTTP method we should use to call
|
42
|
+
# `status_callback_url`. Can be: `GET` or `POST`.
|
43
|
+
# @param [Boolean] cnam_lookup_enabled Whether Caller ID Name (CNAM) lookup is
|
44
|
+
# enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the
|
45
|
+
# United States and Canada automatically perform a CNAM Lookup and display Caller
|
46
|
+
# ID data on your phone. See [CNAM
|
47
|
+
# Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
|
48
|
+
# @param [String] connection_policy_sid The SID of the Connection Policy that
|
49
|
+
# Twilio will use when routing traffic to your communications infrastructure.
|
50
|
+
# @param [String] from_domain_sid The SID of the SIP Domain that should be used in
|
51
|
+
# the `From` header of originating calls sent to your SIP infrastructure. If your
|
52
|
+
# SIP infrastructure allows users to "call back" an incoming call, configure this
|
53
|
+
# with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure
|
54
|
+
# proper routing. If not configured, the from domain will default to
|
55
|
+
# "sip.twilio.com".
|
56
|
+
# @return [ByocTrunkInstance] Newly created ByocTrunkInstance
|
57
|
+
def create(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset)
|
58
|
+
data = Twilio::Values.of({
|
59
|
+
'FriendlyName' => friendly_name,
|
60
|
+
'VoiceUrl' => voice_url,
|
61
|
+
'VoiceMethod' => voice_method,
|
62
|
+
'VoiceFallbackUrl' => voice_fallback_url,
|
63
|
+
'VoiceFallbackMethod' => voice_fallback_method,
|
64
|
+
'StatusCallbackUrl' => status_callback_url,
|
65
|
+
'StatusCallbackMethod' => status_callback_method,
|
66
|
+
'CnamLookupEnabled' => cnam_lookup_enabled,
|
67
|
+
'ConnectionPolicySid' => connection_policy_sid,
|
68
|
+
'FromDomainSid' => from_domain_sid,
|
69
|
+
})
|
70
|
+
|
71
|
+
payload = @version.create(
|
72
|
+
'POST',
|
73
|
+
@uri,
|
74
|
+
data: data
|
75
|
+
)
|
76
|
+
|
77
|
+
ByocTrunkInstance.new(@version, payload, )
|
78
|
+
end
|
79
|
+
|
80
|
+
##
|
81
|
+
# Lists ByocTrunkInstance records from the API as a list.
|
82
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
83
|
+
# memory before returning.
|
84
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
85
|
+
# guarantees to never return more than limit. Default is no limit
|
86
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
87
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
88
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
89
|
+
# efficient page size, i.e. min(limit, 1000)
|
90
|
+
# @return [Array] Array of up to limit results
|
91
|
+
def list(limit: nil, page_size: nil)
|
92
|
+
self.stream(limit: limit, page_size: page_size).entries
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Streams ByocTrunkInstance records from the API as an Enumerable.
|
97
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
98
|
+
# is reached.
|
99
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
100
|
+
# guarantees to never return more than limit. Default is no limit.
|
101
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
102
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
103
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
104
|
+
# efficient page size, i.e. min(limit, 1000)
|
105
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
106
|
+
def stream(limit: nil, page_size: nil)
|
107
|
+
limits = @version.read_limits(limit, page_size)
|
108
|
+
|
109
|
+
page = self.page(page_size: limits[:page_size], )
|
110
|
+
|
111
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# When passed a block, yields ByocTrunkInstance records from the API.
|
116
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
117
|
+
# is reached.
|
118
|
+
def each
|
119
|
+
limits = @version.read_limits
|
120
|
+
|
121
|
+
page = self.page(page_size: limits[:page_size], )
|
122
|
+
|
123
|
+
@version.stream(page,
|
124
|
+
limit: limits[:limit],
|
125
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
126
|
+
end
|
127
|
+
|
128
|
+
##
|
129
|
+
# Retrieve a single page of ByocTrunkInstance records from the API.
|
130
|
+
# Request is executed immediately.
|
131
|
+
# @param [String] page_token PageToken provided by the API
|
132
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
133
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
134
|
+
# @return [Page] Page of ByocTrunkInstance
|
135
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
136
|
+
params = Twilio::Values.of({
|
137
|
+
'PageToken' => page_token,
|
138
|
+
'Page' => page_number,
|
139
|
+
'PageSize' => page_size,
|
140
|
+
})
|
141
|
+
response = @version.page(
|
142
|
+
'GET',
|
143
|
+
@uri,
|
144
|
+
params
|
145
|
+
)
|
146
|
+
ByocTrunkPage.new(@version, response, @solution)
|
147
|
+
end
|
148
|
+
|
149
|
+
##
|
150
|
+
# Retrieve a single page of ByocTrunkInstance records from the API.
|
151
|
+
# Request is executed immediately.
|
152
|
+
# @param [String] target_url API-generated URL for the requested results page
|
153
|
+
# @return [Page] Page of ByocTrunkInstance
|
154
|
+
def get_page(target_url)
|
155
|
+
response = @version.domain.request(
|
156
|
+
'GET',
|
157
|
+
target_url
|
158
|
+
)
|
159
|
+
ByocTrunkPage.new(@version, response, @solution)
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# Provide a user friendly representation
|
164
|
+
def to_s
|
165
|
+
'#<Twilio.Voice.V1.ByocTrunkList>'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
class ByocTrunkPage < Page
|
170
|
+
##
|
171
|
+
# Initialize the ByocTrunkPage
|
172
|
+
# @param [Version] version Version that contains the resource
|
173
|
+
# @param [Response] response Response from the API
|
174
|
+
# @param [Hash] solution Path solution for the resource
|
175
|
+
# @return [ByocTrunkPage] ByocTrunkPage
|
176
|
+
def initialize(version, response, solution)
|
177
|
+
super(version, response)
|
178
|
+
|
179
|
+
# Path Solution
|
180
|
+
@solution = solution
|
181
|
+
end
|
182
|
+
|
183
|
+
##
|
184
|
+
# Build an instance of ByocTrunkInstance
|
185
|
+
# @param [Hash] payload Payload response from the API
|
186
|
+
# @return [ByocTrunkInstance] ByocTrunkInstance
|
187
|
+
def get_instance(payload)
|
188
|
+
ByocTrunkInstance.new(@version, payload, )
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# Provide a user friendly representation
|
193
|
+
def to_s
|
194
|
+
'<Twilio.Voice.V1.ByocTrunkPage>'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
class ByocTrunkContext < InstanceContext
|
199
|
+
##
|
200
|
+
# Initialize the ByocTrunkContext
|
201
|
+
# @param [Version] version Version that contains the resource
|
202
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the BYOC
|
203
|
+
# Trunk resource to fetch.
|
204
|
+
# @return [ByocTrunkContext] ByocTrunkContext
|
205
|
+
def initialize(version, sid)
|
206
|
+
super(version)
|
207
|
+
|
208
|
+
# Path Solution
|
209
|
+
@solution = {sid: sid, }
|
210
|
+
@uri = "/ByocTrunks/#{@solution[:sid]}"
|
211
|
+
end
|
212
|
+
|
213
|
+
##
|
214
|
+
# Fetch a ByocTrunkInstance
|
215
|
+
# @return [ByocTrunkInstance] Fetched ByocTrunkInstance
|
216
|
+
def fetch
|
217
|
+
params = Twilio::Values.of({})
|
218
|
+
|
219
|
+
payload = @version.fetch(
|
220
|
+
'GET',
|
221
|
+
@uri,
|
222
|
+
params,
|
223
|
+
)
|
224
|
+
|
225
|
+
ByocTrunkInstance.new(@version, payload, sid: @solution[:sid], )
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# Update the ByocTrunkInstance
|
230
|
+
# @param [String] friendly_name A descriptive string that you create to describe
|
231
|
+
# the resource. It is not unique and can be up to 255 characters long.
|
232
|
+
# @param [String] voice_url The URL we should call when the BYOC Trunk receives a
|
233
|
+
# call.
|
234
|
+
# @param [String] voice_method The HTTP method we should use to call `voice_url`
|
235
|
+
# @param [String] voice_fallback_url The URL that we should call when an error
|
236
|
+
# occurs while retrieving or executing the TwiML requested by `voice_url`.
|
237
|
+
# @param [String] voice_fallback_method The HTTP method we should use to call
|
238
|
+
# `voice_fallback_url`. Can be: `GET` or `POST`.
|
239
|
+
# @param [String] status_callback_url The URL that we should call to pass status
|
240
|
+
# parameters (such as call ended) to your application.
|
241
|
+
# @param [String] status_callback_method The HTTP method we should use to call
|
242
|
+
# `status_callback_url`. Can be: `GET` or `POST`.
|
243
|
+
# @param [Boolean] cnam_lookup_enabled Whether Caller ID Name (CNAM) lookup is
|
244
|
+
# enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the
|
245
|
+
# United States and Canada automatically perform a CNAM Lookup and display Caller
|
246
|
+
# ID data on your phone. See [CNAM
|
247
|
+
# Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
|
248
|
+
# @param [String] connection_policy_sid The SID of the Connection Policy that
|
249
|
+
# Twilio will use when routing traffic to your communications infrastructure.
|
250
|
+
# @param [String] from_domain_sid The SID of the SIP Domain that should be used in
|
251
|
+
# the `From` header of originating calls sent to your SIP infrastructure. If your
|
252
|
+
# SIP infrastructure allows users to "call back" an incoming call, configure this
|
253
|
+
# with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure
|
254
|
+
# proper routing. If not configured, the from domain will default to
|
255
|
+
# "sip.twilio.com".
|
256
|
+
# @return [ByocTrunkInstance] Updated ByocTrunkInstance
|
257
|
+
def update(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset)
|
258
|
+
data = Twilio::Values.of({
|
259
|
+
'FriendlyName' => friendly_name,
|
260
|
+
'VoiceUrl' => voice_url,
|
261
|
+
'VoiceMethod' => voice_method,
|
262
|
+
'VoiceFallbackUrl' => voice_fallback_url,
|
263
|
+
'VoiceFallbackMethod' => voice_fallback_method,
|
264
|
+
'StatusCallbackUrl' => status_callback_url,
|
265
|
+
'StatusCallbackMethod' => status_callback_method,
|
266
|
+
'CnamLookupEnabled' => cnam_lookup_enabled,
|
267
|
+
'ConnectionPolicySid' => connection_policy_sid,
|
268
|
+
'FromDomainSid' => from_domain_sid,
|
269
|
+
})
|
270
|
+
|
271
|
+
payload = @version.update(
|
272
|
+
'POST',
|
273
|
+
@uri,
|
274
|
+
data: data,
|
275
|
+
)
|
276
|
+
|
277
|
+
ByocTrunkInstance.new(@version, payload, sid: @solution[:sid], )
|
278
|
+
end
|
279
|
+
|
280
|
+
##
|
281
|
+
# Deletes the ByocTrunkInstance
|
282
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
283
|
+
def delete
|
284
|
+
@version.delete('delete', @uri)
|
285
|
+
end
|
286
|
+
|
287
|
+
##
|
288
|
+
# Provide a user friendly representation
|
289
|
+
def to_s
|
290
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
291
|
+
"#<Twilio.Voice.V1.ByocTrunkContext #{context}>"
|
292
|
+
end
|
293
|
+
|
294
|
+
##
|
295
|
+
# Provide a detailed, user friendly representation
|
296
|
+
def inspect
|
297
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
298
|
+
"#<Twilio.Voice.V1.ByocTrunkContext #{context}>"
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
class ByocTrunkInstance < InstanceResource
|
303
|
+
##
|
304
|
+
# Initialize the ByocTrunkInstance
|
305
|
+
# @param [Version] version Version that contains the resource
|
306
|
+
# @param [Hash] payload payload that contains response from Twilio
|
307
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the BYOC
|
308
|
+
# Trunk resource to fetch.
|
309
|
+
# @return [ByocTrunkInstance] ByocTrunkInstance
|
310
|
+
def initialize(version, payload, sid: nil)
|
311
|
+
super(version)
|
312
|
+
|
313
|
+
# Marshaled Properties
|
314
|
+
@properties = {
|
315
|
+
'account_sid' => payload['account_sid'],
|
316
|
+
'sid' => payload['sid'],
|
317
|
+
'friendly_name' => payload['friendly_name'],
|
318
|
+
'voice_url' => payload['voice_url'],
|
319
|
+
'voice_method' => payload['voice_method'],
|
320
|
+
'voice_fallback_url' => payload['voice_fallback_url'],
|
321
|
+
'voice_fallback_method' => payload['voice_fallback_method'],
|
322
|
+
'status_callback_url' => payload['status_callback_url'],
|
323
|
+
'status_callback_method' => payload['status_callback_method'],
|
324
|
+
'cnam_lookup_enabled' => payload['cnam_lookup_enabled'],
|
325
|
+
'connection_policy_sid' => payload['connection_policy_sid'],
|
326
|
+
'from_domain_sid' => payload['from_domain_sid'],
|
327
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
328
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
329
|
+
'url' => payload['url'],
|
330
|
+
}
|
331
|
+
|
332
|
+
# Context
|
333
|
+
@instance_context = nil
|
334
|
+
@params = {'sid' => sid || @properties['sid'], }
|
335
|
+
end
|
336
|
+
|
337
|
+
##
|
338
|
+
# Generate an instance context for the instance, the context is capable of
|
339
|
+
# performing various actions. All instance actions are proxied to the context
|
340
|
+
# @return [ByocTrunkContext] ByocTrunkContext for this ByocTrunkInstance
|
341
|
+
def context
|
342
|
+
unless @instance_context
|
343
|
+
@instance_context = ByocTrunkContext.new(@version, @params['sid'], )
|
344
|
+
end
|
345
|
+
@instance_context
|
346
|
+
end
|
347
|
+
|
348
|
+
##
|
349
|
+
# @return [String] The SID of the Account that created the resource
|
350
|
+
def account_sid
|
351
|
+
@properties['account_sid']
|
352
|
+
end
|
353
|
+
|
354
|
+
##
|
355
|
+
# @return [String] The unique string that identifies the resource
|
356
|
+
def sid
|
357
|
+
@properties['sid']
|
358
|
+
end
|
359
|
+
|
360
|
+
##
|
361
|
+
# @return [String] The string that you assigned to describe the resource
|
362
|
+
def friendly_name
|
363
|
+
@properties['friendly_name']
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# @return [String] The URL we call when receiving a call
|
368
|
+
def voice_url
|
369
|
+
@properties['voice_url']
|
370
|
+
end
|
371
|
+
|
372
|
+
##
|
373
|
+
# @return [String] The HTTP method to use with voice_url
|
374
|
+
def voice_method
|
375
|
+
@properties['voice_method']
|
376
|
+
end
|
377
|
+
|
378
|
+
##
|
379
|
+
# @return [String] The URL we call when an error occurs while executing TwiML
|
380
|
+
def voice_fallback_url
|
381
|
+
@properties['voice_fallback_url']
|
382
|
+
end
|
383
|
+
|
384
|
+
##
|
385
|
+
# @return [String] The HTTP method used with voice_fallback_url
|
386
|
+
def voice_fallback_method
|
387
|
+
@properties['voice_fallback_method']
|
388
|
+
end
|
389
|
+
|
390
|
+
##
|
391
|
+
# @return [String] The URL that we call with status updates
|
392
|
+
def status_callback_url
|
393
|
+
@properties['status_callback_url']
|
394
|
+
end
|
395
|
+
|
396
|
+
##
|
397
|
+
# @return [String] The HTTP method we use to call status_callback_url
|
398
|
+
def status_callback_method
|
399
|
+
@properties['status_callback_method']
|
400
|
+
end
|
401
|
+
|
402
|
+
##
|
403
|
+
# @return [Boolean] Whether Caller ID Name (CNAM) lookup is enabled for the trunk
|
404
|
+
def cnam_lookup_enabled
|
405
|
+
@properties['cnam_lookup_enabled']
|
406
|
+
end
|
407
|
+
|
408
|
+
##
|
409
|
+
# @return [String] Origination Connection Policy (to your Carrier)
|
410
|
+
def connection_policy_sid
|
411
|
+
@properties['connection_policy_sid']
|
412
|
+
end
|
413
|
+
|
414
|
+
##
|
415
|
+
# @return [String] The SID of the SIP Domain that should be used in the `From` header of originating calls
|
416
|
+
def from_domain_sid
|
417
|
+
@properties['from_domain_sid']
|
418
|
+
end
|
419
|
+
|
420
|
+
##
|
421
|
+
# @return [Time] The RFC 2822 date and time in GMT that the resource was created
|
422
|
+
def date_created
|
423
|
+
@properties['date_created']
|
424
|
+
end
|
425
|
+
|
426
|
+
##
|
427
|
+
# @return [Time] The RFC 2822 date and time in GMT that the resource was last updated
|
428
|
+
def date_updated
|
429
|
+
@properties['date_updated']
|
430
|
+
end
|
431
|
+
|
432
|
+
##
|
433
|
+
# @return [String] The absolute URL of the resource
|
434
|
+
def url
|
435
|
+
@properties['url']
|
436
|
+
end
|
437
|
+
|
438
|
+
##
|
439
|
+
# Fetch a ByocTrunkInstance
|
440
|
+
# @return [ByocTrunkInstance] Fetched ByocTrunkInstance
|
441
|
+
def fetch
|
442
|
+
context.fetch
|
443
|
+
end
|
444
|
+
|
445
|
+
##
|
446
|
+
# Update the ByocTrunkInstance
|
447
|
+
# @param [String] friendly_name A descriptive string that you create to describe
|
448
|
+
# the resource. It is not unique and can be up to 255 characters long.
|
449
|
+
# @param [String] voice_url The URL we should call when the BYOC Trunk receives a
|
450
|
+
# call.
|
451
|
+
# @param [String] voice_method The HTTP method we should use to call `voice_url`
|
452
|
+
# @param [String] voice_fallback_url The URL that we should call when an error
|
453
|
+
# occurs while retrieving or executing the TwiML requested by `voice_url`.
|
454
|
+
# @param [String] voice_fallback_method The HTTP method we should use to call
|
455
|
+
# `voice_fallback_url`. Can be: `GET` or `POST`.
|
456
|
+
# @param [String] status_callback_url The URL that we should call to pass status
|
457
|
+
# parameters (such as call ended) to your application.
|
458
|
+
# @param [String] status_callback_method The HTTP method we should use to call
|
459
|
+
# `status_callback_url`. Can be: `GET` or `POST`.
|
460
|
+
# @param [Boolean] cnam_lookup_enabled Whether Caller ID Name (CNAM) lookup is
|
461
|
+
# enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the
|
462
|
+
# United States and Canada automatically perform a CNAM Lookup and display Caller
|
463
|
+
# ID data on your phone. See [CNAM
|
464
|
+
# Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
|
465
|
+
# @param [String] connection_policy_sid The SID of the Connection Policy that
|
466
|
+
# Twilio will use when routing traffic to your communications infrastructure.
|
467
|
+
# @param [String] from_domain_sid The SID of the SIP Domain that should be used in
|
468
|
+
# the `From` header of originating calls sent to your SIP infrastructure. If your
|
469
|
+
# SIP infrastructure allows users to "call back" an incoming call, configure this
|
470
|
+
# with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure
|
471
|
+
# proper routing. If not configured, the from domain will default to
|
472
|
+
# "sip.twilio.com".
|
473
|
+
# @return [ByocTrunkInstance] Updated ByocTrunkInstance
|
474
|
+
def update(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset)
|
475
|
+
context.update(
|
476
|
+
friendly_name: friendly_name,
|
477
|
+
voice_url: voice_url,
|
478
|
+
voice_method: voice_method,
|
479
|
+
voice_fallback_url: voice_fallback_url,
|
480
|
+
voice_fallback_method: voice_fallback_method,
|
481
|
+
status_callback_url: status_callback_url,
|
482
|
+
status_callback_method: status_callback_method,
|
483
|
+
cnam_lookup_enabled: cnam_lookup_enabled,
|
484
|
+
connection_policy_sid: connection_policy_sid,
|
485
|
+
from_domain_sid: from_domain_sid,
|
486
|
+
)
|
487
|
+
end
|
488
|
+
|
489
|
+
##
|
490
|
+
# Deletes the ByocTrunkInstance
|
491
|
+
# @return [Boolean] true if delete succeeds, false otherwise
|
492
|
+
def delete
|
493
|
+
context.delete
|
494
|
+
end
|
495
|
+
|
496
|
+
##
|
497
|
+
# Provide a user friendly representation
|
498
|
+
def to_s
|
499
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
500
|
+
"<Twilio.Voice.V1.ByocTrunkInstance #{values}>"
|
501
|
+
end
|
502
|
+
|
503
|
+
##
|
504
|
+
# Provide a detailed, user friendly representation
|
505
|
+
def inspect
|
506
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
507
|
+
"<Twilio.Voice.V1.ByocTrunkInstance #{values}>"
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|