twilio-ruby 5.34.0 → 5.38.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/CHANGES.md +126 -0
- data/README.md +24 -3
- data/lib/twilio-ruby.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +87 -87
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +47 -9
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +71 -71
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
- data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
- data/lib/twilio-ruby/rest/api/v2010/account/validation_request.rb +12 -12
- 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/assistant.rb +0 -16
- data/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +12 -3
- data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
- data/lib/twilio-ruby/rest/client.rb +35 -15
- data/lib/twilio-ruby/rest/conversations/v1/conversation.rb +28 -3
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
- data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +6 -3
- data/lib/twilio-ruby/rest/monitor/v1/alert.rb +8 -8
- data/lib/twilio-ruby/rest/notify/v1/service.rb +20 -1
- 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/preview.rb +6 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +7 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/brands_information.rb +193 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
- data/lib/twilio-ruby/rest/{autopilot/v1/assistant/export_assistant.rb → preview/trusted_comms/business/brand.rb} +88 -71
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +194 -0
- data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
- data/lib/twilio-ruby/rest/supersim.rb +18 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +30 -0
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +63 -16
- data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
- data/lib/twilio-ruby/rest/{authy/v1/service.rb → supersim/v1/network_access_profile.rb} +95 -121
- data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
- data/lib/twilio-ruby/rest/verify.rb +9 -0
- data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/form.rb +8 -8
- data/lib/twilio-ruby/rest/verify/v2/service.rb +74 -3
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity.rb +32 -8
- data/lib/twilio-ruby/rest/verify/v2/service/entity/access_token.rb +141 -0
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity/factor.rb +8 -8
- data/lib/twilio-ruby/rest/{authy/v1 → verify/v2}/service/entity/factor/challenge.rb +8 -8
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
- data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +425 -0
- data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -4
- data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -4
- 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/util/configuration.rb +9 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/call_spec.rb +5 -5
- data/spec/integration/api/v2010/account/conference/participant_spec.rb +177 -0
- data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
- data/spec/integration/api/v2010/account/outgoing_caller_id_spec.rb +8 -14
- 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/api/v2010/account/validation_request_spec.rb +1 -1
- data/spec/integration/autopilot/v1/assistant/query_spec.rb +4 -4
- data/spec/integration/autopilot/v1/assistant_spec.rb +4 -8
- data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
- data/spec/integration/conversations/v1/conversation_spec.rb +16 -0
- data/spec/integration/flex_api/v1/configuration_spec.rb +3 -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/preview/trusted_comms/brands_information_spec.rb +44 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
- data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
- data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
- data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
- data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
- data/spec/integration/supersim/v1/fleet_spec.rb +16 -7
- data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
- data/spec/integration/supersim/v1/network_access_profile_spec.rb +223 -0
- data/spec/integration/supersim/v1/network_spec.rb +139 -0
- data/spec/integration/supersim/v1/sim_spec.rb +78 -6
- data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
- data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
- data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
- data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
- data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
- data/spec/integration/{authy/v1 → verify/v2}/form_spec.rb +4 -4
- data/spec/integration/verify/v2/service/entity/access_token_spec.rb +46 -0
- data/spec/integration/{authy/v1 → verify/v2}/service/entity/factor/challenge_spec.rb +73 -73
- data/spec/integration/{authy/v1 → verify/v2}/service/entity/factor_spec.rb +54 -54
- data/spec/integration/verify/v2/service/entity_spec.rb +204 -0
- data/spec/integration/verify/v2/service/webhook_spec.rb +262 -0
- data/spec/integration/verify/v2/service_spec.rb +32 -4
- 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/spec/rest/client_spec.rb +168 -58
- data/spec/util/configuration_spec.rb +12 -0
- data/twilio-ruby.gemspec +1 -1
- metadata +63 -23
- data/lib/twilio-ruby/rest/authy.rb +0 -55
- data/lib/twilio-ruby/rest/authy/v1.rb +0 -59
- data/spec/integration/authy/v1/service/entity_spec.rb +0 -201
- data/spec/integration/authy/v1/service_spec.rb +0 -231
- data/spec/integration/autopilot/v1/assistant/export_assistant_spec.rb +0 -49
@@ -96,8 +96,10 @@ module Twilio
|
|
96
96
|
# encryption.
|
97
97
|
# @param [String] aws_s3_url The URL of the AWS S3 bucket where the compositions
|
98
98
|
# should be stored. We only support DNS-compliant URLs like
|
99
|
-
# `
|
100
|
-
# `compositions` is the path in which you want the compositions to be stored.
|
99
|
+
# `https://<my-bucket>.s3-<aws-region>.amazonaws.com/compositions`, where
|
100
|
+
# `compositions` is the path in which you want the compositions to be stored. This
|
101
|
+
# URL accepts only URI-valid characters, as described in the <a
|
102
|
+
# href='https://tools.ietf.org/html/rfc3986#section-2'>RFC 3986</a>.
|
101
103
|
# @param [Boolean] aws_storage_enabled Whether all compositions should be written
|
102
104
|
# to the `aws_s3_url`. When `false`, all compositions are stored in our cloud.
|
103
105
|
# @param [Boolean] encryption_enabled Whether all compositions should be stored in
|
@@ -239,8 +241,10 @@ module Twilio
|
|
239
241
|
# encryption.
|
240
242
|
# @param [String] aws_s3_url The URL of the AWS S3 bucket where the compositions
|
241
243
|
# should be stored. We only support DNS-compliant URLs like
|
242
|
-
# `
|
243
|
-
# `compositions` is the path in which you want the compositions to be stored.
|
244
|
+
# `https://<my-bucket>.s3-<aws-region>.amazonaws.com/compositions`, where
|
245
|
+
# `compositions` is the path in which you want the compositions to be stored. This
|
246
|
+
# URL accepts only URI-valid characters, as described in the <a
|
247
|
+
# href='https://tools.ietf.org/html/rfc3986#section-2'>RFC 3986</a>.
|
244
248
|
# @param [Boolean] aws_storage_enabled Whether all compositions should be written
|
245
249
|
# to the `aws_s3_url`. When `false`, all compositions are stored in our cloud.
|
246
250
|
# @param [Boolean] encryption_enabled Whether all compositions should be stored in
|
@@ -96,8 +96,10 @@ module Twilio
|
|
96
96
|
# encryption.
|
97
97
|
# @param [String] aws_s3_url The URL of the AWS S3 bucket where the recordings
|
98
98
|
# should be stored. We only support DNS-compliant URLs like
|
99
|
-
# `
|
100
|
-
# `recordings` is the path in which you want the recordings to be stored.
|
99
|
+
# `https://<my-bucket>.s3-<aws-region>.amazonaws.com/recordings`, where
|
100
|
+
# `recordings` is the path in which you want the recordings to be stored. This URL
|
101
|
+
# accepts only URI-valid characters, as described in the <a
|
102
|
+
# href='https://tools.ietf.org/html/rfc3986#section-2'>RFC 3986</a>.
|
101
103
|
# @param [Boolean] aws_storage_enabled Whether all recordings should be written to
|
102
104
|
# the `aws_s3_url`. When `false`, all recordings are stored in our cloud.
|
103
105
|
# @param [Boolean] encryption_enabled Whether all recordings should be stored in
|
@@ -239,8 +241,10 @@ module Twilio
|
|
239
241
|
# encryption.
|
240
242
|
# @param [String] aws_s3_url The URL of the AWS S3 bucket where the recordings
|
241
243
|
# should be stored. We only support DNS-compliant URLs like
|
242
|
-
# `
|
243
|
-
# `recordings` is the path in which you want the recordings to be stored.
|
244
|
+
# `https://<my-bucket>.s3-<aws-region>.amazonaws.com/recordings`, where
|
245
|
+
# `recordings` is the path in which you want the recordings to be stored. This URL
|
246
|
+
# accepts only URI-valid characters, as described in the <a
|
247
|
+
# href='https://tools.ietf.org/html/rfc3986#section-2'>RFC 3986</a>.
|
244
248
|
# @param [Boolean] aws_storage_enabled Whether all recordings should be written to
|
245
249
|
# the `aws_s3_url`. When `false`, all recordings are stored in our cloud.
|
246
250
|
# @param [Boolean] encryption_enabled Whether all recordings should be stored in
|
@@ -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
|