twilio-ruby 7.11.3 → 7.13.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 +277 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/examples/WebhookSignatureValidation.md +61 -0
- data/lib/rack/twilio_webhook_authentication.rb +30 -5
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +4 -4
- data/lib/twilio-ruby/rest/client.rb +5 -0
- data/lib/twilio-ruby/rest/content/v1/content/approval_create.rb +108 -1
- data/lib/twilio-ruby/rest/content/v1/content.rb +10 -4
- data/lib/twilio-ruby/rest/conversations/v2/action.rb +9 -2
- data/lib/twilio-ruby/rest/conversations/v2/communication.rb +4 -1
- data/lib/twilio-ruby/rest/conversations/v2/configuration.rb +21 -0
- data/lib/twilio-ruby/rest/conversations/v2/conversation.rb +226 -7
- data/lib/twilio-ruby/rest/insights/v1/call/call_summary.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb +512 -17
- data/lib/twilio-ruby/rest/insights/v3/{capacity.rb → custom_field_mappings_capacity.rb} +26 -26
- data/lib/twilio-ruby/rest/insights/v3.rb +17 -7
- data/lib/twilio-ruby/rest/memory/v1/bulk.rb +22 -1
- data/lib/twilio-ruby/rest/memory/v1/conversation_summary.rb +5 -5
- data/lib/twilio-ruby/rest/memory/v1/import.rb +21 -7
- data/lib/twilio-ruby/rest/memory/v1/observation.rb +9 -9
- data/lib/twilio-ruby/rest/memory/v1/revision.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/store.rb +7 -0
- data/lib/twilio-ruby/rest/messaging/v2/channels_sender.rb +30 -2
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification.rb +30 -6
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification_check.rb +30 -6
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification.rb +45 -6
- data/lib/twilio-ruby/rest/numbers/v1.rb +0 -6
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +40 -0
- data/lib/twilio-ruby/rest/routes/v3/iso_country_code.rb +402 -0
- data/lib/twilio-ruby/rest/routes/v3.rb +43 -0
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_brand_registration.rb +5 -5
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_campaign_registration.rb +4 -4
- data/lib/twilio-ruby/rest/trusthub/v1.rb +2 -2
- data/lib/twilio-ruby/rest/webhooks/v1/auth_profile.rb +825 -0
- data/lib/twilio-ruby/rest/webhooks/v1/edge_zone.rb +320 -0
- data/lib/twilio-ruby/rest/webhooks/v1/operation.rb +513 -0
- data/lib/twilio-ruby/rest/webhooks/v1/rule.rb +818 -0
- data/lib/twilio-ruby/rest/webhooks/v1/setting.rb +1028 -0
- data/lib/twilio-ruby/rest/webhooks/v1/shared_key.rb +722 -0
- data/lib/twilio-ruby/rest/webhooks/v1/test.rb +228 -0
- data/lib/twilio-ruby/rest/webhooks/v1.rb +126 -0
- data/lib/twilio-ruby/rest/webhooks.rb +6 -0
- data/lib/twilio-ruby/rest/webhooks_base.rb +38 -0
- data/lib/twilio-ruby/security/request_validator.rb +54 -8
- data/lib/twilio-ruby/twiml/voice_response.rb +20 -5
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +15 -5
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification_check.rb +0 -165
- data/lib/twilio-ruby/rest/oauth/v2/oauth_authorization_server.rb +0 -200
|
@@ -19,6 +19,26 @@ module Twilio
|
|
|
19
19
|
class V1 < Version
|
|
20
20
|
class SmsVerificationCheckList < ListResource
|
|
21
21
|
|
|
22
|
+
class NumbersV1SmsVerificationCheckRequest
|
|
23
|
+
# @param [to]: [String] The phone number being verified in E.164 format.
|
|
24
|
+
# @param [verification_code]: [String] The 6 character verification code to check.
|
|
25
|
+
# @param [friendly_name]: [String] A human-readable name for the caller ID.
|
|
26
|
+
attr_accessor :to, :verification_code, :friendly_name
|
|
27
|
+
def initialize(payload)
|
|
28
|
+
@to = payload["to"]
|
|
29
|
+
@verification_code = payload["verification_code"]
|
|
30
|
+
@friendly_name = payload["friendly_name"]
|
|
31
|
+
end
|
|
32
|
+
def to_json(options = {})
|
|
33
|
+
{
|
|
34
|
+
"to": @to,
|
|
35
|
+
"verification_code": @verification_code,
|
|
36
|
+
"friendly_name": @friendly_name,
|
|
37
|
+
}.to_json(options)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
22
42
|
##
|
|
23
43
|
# Initialize the SmsVerificationCheckList
|
|
24
44
|
# @param [Version] version Version that contains the resource
|
|
@@ -33,16 +53,18 @@ module Twilio
|
|
|
33
53
|
end
|
|
34
54
|
##
|
|
35
55
|
# Create the SmsVerificationCheckInstance
|
|
56
|
+
# @param [NumbersV1SmsVerificationCheckRequest] numbers_v1_sms_verification_check_request
|
|
36
57
|
# @return [SmsVerificationCheckInstance] Created SmsVerificationCheckInstance
|
|
37
|
-
def create
|
|
58
|
+
def create(numbers_v1_sms_verification_check_request: nil
|
|
59
|
+
)
|
|
38
60
|
|
|
39
61
|
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
62
|
+
headers['Content-Type'] = 'application/json'
|
|
40
63
|
|
|
41
64
|
|
|
42
65
|
|
|
43
66
|
|
|
44
|
-
|
|
45
|
-
payload = @version.create('POST', @uri, headers: headers)
|
|
67
|
+
payload = @version.create('POST', @uri, headers: headers, data: numbers_v1_sms_verification_check_request.to_json)
|
|
46
68
|
SmsVerificationCheckInstance.new(
|
|
47
69
|
@version,
|
|
48
70
|
payload,
|
|
@@ -51,16 +73,18 @@ module Twilio
|
|
|
51
73
|
|
|
52
74
|
##
|
|
53
75
|
# Create the SmsVerificationCheckInstanceMetadata
|
|
76
|
+
# @param [NumbersV1SmsVerificationCheckRequest] numbers_v1_sms_verification_check_request
|
|
54
77
|
# @return [SmsVerificationCheckInstance] Created SmsVerificationCheckInstance
|
|
55
|
-
def create_with_metadata
|
|
78
|
+
def create_with_metadata(numbers_v1_sms_verification_check_request: nil
|
|
79
|
+
)
|
|
56
80
|
|
|
57
81
|
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
82
|
+
headers['Content-Type'] = 'application/json'
|
|
58
83
|
|
|
59
84
|
|
|
60
85
|
|
|
61
86
|
|
|
62
|
-
|
|
63
|
-
response = @version.create_with_metadata('POST', @uri, headers: headers)
|
|
87
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: numbers_v1_sms_verification_check_request.to_json)
|
|
64
88
|
sms_verification_check_instance = SmsVerificationCheckInstance.new(
|
|
65
89
|
@version,
|
|
66
90
|
response.body,
|
|
@@ -19,6 +19,41 @@ module Twilio
|
|
|
19
19
|
class V1 < Version
|
|
20
20
|
class VoiceVerificationList < ListResource
|
|
21
21
|
|
|
22
|
+
class NumbersV1VoiceVerificationRequest
|
|
23
|
+
# @param [phone_number]: [String] The phone number to verify in E.164 format.
|
|
24
|
+
# @param [friendly_name]: [String] A human-readable name for the caller ID.
|
|
25
|
+
# @param [custom_code]: [String] A custom verification code to use instead of a generated one.
|
|
26
|
+
# @param [call_delay]: [String] Number of seconds to delay the verification call (0-60).
|
|
27
|
+
# @param [status_callback]: [String] URL to receive status callback events.
|
|
28
|
+
# @param [status_callback_method]: [String] HTTP method for status callback requests.
|
|
29
|
+
# @param [extension]: [String] Phone extension to dial after connecting.
|
|
30
|
+
# @param [custom_success_message]: [String] Custom message to play after successful verification.
|
|
31
|
+
attr_accessor :phone_number, :friendly_name, :custom_code, :call_delay, :status_callback, :status_callback_method, :extension, :custom_success_message
|
|
32
|
+
def initialize(payload)
|
|
33
|
+
@phone_number = payload["phone_number"]
|
|
34
|
+
@friendly_name = payload["friendly_name"]
|
|
35
|
+
@custom_code = payload["custom_code"]
|
|
36
|
+
@call_delay = payload["call_delay"]
|
|
37
|
+
@status_callback = payload["status_callback"]
|
|
38
|
+
@status_callback_method = payload["status_callback_method"]
|
|
39
|
+
@extension = payload["extension"]
|
|
40
|
+
@custom_success_message = payload["custom_success_message"]
|
|
41
|
+
end
|
|
42
|
+
def to_json(options = {})
|
|
43
|
+
{
|
|
44
|
+
"phone_number": @phone_number,
|
|
45
|
+
"friendly_name": @friendly_name,
|
|
46
|
+
"custom_code": @custom_code,
|
|
47
|
+
"call_delay": @call_delay,
|
|
48
|
+
"status_callback": @status_callback,
|
|
49
|
+
"status_callback_method": @status_callback_method,
|
|
50
|
+
"extension": @extension,
|
|
51
|
+
"custom_success_message": @custom_success_message,
|
|
52
|
+
}.to_json(options)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
|
|
22
57
|
##
|
|
23
58
|
# Initialize the VoiceVerificationList
|
|
24
59
|
# @param [Version] version Version that contains the resource
|
|
@@ -33,16 +68,18 @@ module Twilio
|
|
|
33
68
|
end
|
|
34
69
|
##
|
|
35
70
|
# Create the VoiceVerificationInstance
|
|
71
|
+
# @param [NumbersV1VoiceVerificationRequest] numbers_v1_voice_verification_request
|
|
36
72
|
# @return [VoiceVerificationInstance] Created VoiceVerificationInstance
|
|
37
|
-
def create
|
|
73
|
+
def create(numbers_v1_voice_verification_request: nil
|
|
74
|
+
)
|
|
38
75
|
|
|
39
76
|
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
77
|
+
headers['Content-Type'] = 'application/json'
|
|
40
78
|
|
|
41
79
|
|
|
42
80
|
|
|
43
81
|
|
|
44
|
-
|
|
45
|
-
payload = @version.create('POST', @uri, headers: headers)
|
|
82
|
+
payload = @version.create('POST', @uri, headers: headers, data: numbers_v1_voice_verification_request.to_json)
|
|
46
83
|
VoiceVerificationInstance.new(
|
|
47
84
|
@version,
|
|
48
85
|
payload,
|
|
@@ -51,16 +88,18 @@ module Twilio
|
|
|
51
88
|
|
|
52
89
|
##
|
|
53
90
|
# Create the VoiceVerificationInstanceMetadata
|
|
91
|
+
# @param [NumbersV1VoiceVerificationRequest] numbers_v1_voice_verification_request
|
|
54
92
|
# @return [VoiceVerificationInstance] Created VoiceVerificationInstance
|
|
55
|
-
def create_with_metadata
|
|
93
|
+
def create_with_metadata(numbers_v1_voice_verification_request: nil
|
|
94
|
+
)
|
|
56
95
|
|
|
57
96
|
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
97
|
+
headers['Content-Type'] = 'application/json'
|
|
58
98
|
|
|
59
99
|
|
|
60
100
|
|
|
61
101
|
|
|
62
|
-
|
|
63
|
-
response = @version.create_with_metadata('POST', @uri, headers: headers)
|
|
102
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: numbers_v1_voice_verification_request.to_json)
|
|
64
103
|
voice_verification_instance = VoiceVerificationInstance.new(
|
|
65
104
|
@version,
|
|
66
105
|
response.body,
|
|
@@ -35,7 +35,6 @@ module Twilio
|
|
|
35
35
|
@sms_verifications = nil
|
|
36
36
|
@sms_verification_checks = nil
|
|
37
37
|
@voice_verifications = nil
|
|
38
|
-
@voice_verification_checks = nil
|
|
39
38
|
@webhook = nil
|
|
40
39
|
end
|
|
41
40
|
|
|
@@ -196,11 +195,6 @@ module Twilio
|
|
|
196
195
|
@voice_verifications ||= VoiceVerificationList.new self
|
|
197
196
|
end
|
|
198
197
|
##
|
|
199
|
-
# @return [Twilio::REST::Numbers::V1::VoiceVerificationCheckList]
|
|
200
|
-
def voice_verification_checks
|
|
201
|
-
@voice_verification_checks ||= VoiceVerificationCheckList.new self
|
|
202
|
-
end
|
|
203
|
-
##
|
|
204
198
|
# @return [Twilio::REST::Numbers::V1::WebhookList]
|
|
205
199
|
def webhook
|
|
206
200
|
@webhook ||= WebhookList.new self
|
|
@@ -277,6 +277,38 @@ module Twilio
|
|
|
277
277
|
# Dependents
|
|
278
278
|
@dependent_hosted_number_orders = nil
|
|
279
279
|
end
|
|
280
|
+
##
|
|
281
|
+
# Delete the AuthorizationDocumentInstance
|
|
282
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
283
|
+
def delete
|
|
284
|
+
|
|
285
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
@version.delete('DELETE', @uri, headers: headers)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
##
|
|
294
|
+
# Delete the AuthorizationDocumentInstanceMetadata
|
|
295
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
296
|
+
def delete_with_metadata
|
|
297
|
+
|
|
298
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
303
|
+
authorizationDocument_instance = AuthorizationDocumentInstance.new(
|
|
304
|
+
@version,
|
|
305
|
+
response.body,
|
|
306
|
+
account_sid: @solution[:account_sid],
|
|
307
|
+
sid: @solution[:sid],
|
|
308
|
+
)
|
|
309
|
+
AuthorizationDocumentInstanceMetadata.new(@version, authorizationDocument_instance, response.headers, response.status_code)
|
|
310
|
+
end
|
|
311
|
+
|
|
280
312
|
##
|
|
281
313
|
# Fetch the AuthorizationDocumentInstance
|
|
282
314
|
# @return [AuthorizationDocumentInstance] Fetched AuthorizationDocumentInstance
|
|
@@ -675,6 +707,14 @@ module Twilio
|
|
|
675
707
|
@properties['links']
|
|
676
708
|
end
|
|
677
709
|
|
|
710
|
+
##
|
|
711
|
+
# Delete the AuthorizationDocumentInstance
|
|
712
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
713
|
+
def delete
|
|
714
|
+
|
|
715
|
+
context.delete
|
|
716
|
+
end
|
|
717
|
+
|
|
678
718
|
##
|
|
679
719
|
# Fetch the AuthorizationDocumentInstance
|
|
680
720
|
# @return [AuthorizationDocumentInstance] Fetched AuthorizationDocumentInstance
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Routes
|
|
8
|
+
# This is the public Twilio REST API.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This class is auto generated by OpenAPI Generator.
|
|
11
|
+
# https://openapi-generator.tech
|
|
12
|
+
# Do not edit the class manually.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
module Twilio
|
|
17
|
+
module REST
|
|
18
|
+
class Routes < RoutesBase
|
|
19
|
+
class V3 < Version
|
|
20
|
+
class IsoCountryCodeList < ListResource
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Initialize the IsoCountryCodeList
|
|
24
|
+
# @param [Version] version Version that contains the resource
|
|
25
|
+
# @return [IsoCountryCodeList] IsoCountryCodeList
|
|
26
|
+
def initialize(version)
|
|
27
|
+
|
|
28
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
29
|
+
super(apiV1Version)
|
|
30
|
+
# Path Solution
|
|
31
|
+
@solution = { }
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# Provide a user friendly representation
|
|
39
|
+
def to_s
|
|
40
|
+
'#<Twilio.Routes.V3.IsoCountryCodeList>'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class IsoCountryCodeContext < InstanceContext
|
|
46
|
+
##
|
|
47
|
+
# Initialize the IsoCountryCodeContext
|
|
48
|
+
# @param [Version] version Version that contains the resource
|
|
49
|
+
# @param [String] iso_country_code The ISO country code of the short code
|
|
50
|
+
# @param [String] short_code The short code
|
|
51
|
+
# @return [IsoCountryCodeContext] IsoCountryCodeContext
|
|
52
|
+
def initialize(version, iso_country_code, short_code)
|
|
53
|
+
|
|
54
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
55
|
+
super(apiV1Version)
|
|
56
|
+
|
|
57
|
+
# Path Solution
|
|
58
|
+
@solution = { iso_country_code: iso_country_code, short_code: short_code, }
|
|
59
|
+
@uri = "/ShortCodes/#{@solution[:iso_country_code]}/#{@solution[:short_code]}"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
##
|
|
64
|
+
# Fetch the IsoCountryCodeInstance
|
|
65
|
+
# @return [IsoCountryCodeInstance] Fetched IsoCountryCodeInstance
|
|
66
|
+
def fetch
|
|
67
|
+
|
|
68
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
75
|
+
IsoCountryCodeInstance.new(
|
|
76
|
+
@version,
|
|
77
|
+
payload,
|
|
78
|
+
iso_country_code: @solution[:iso_country_code],
|
|
79
|
+
short_code: @solution[:short_code],
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
##
|
|
84
|
+
# Fetch the IsoCountryCodeInstanceMetadata
|
|
85
|
+
# @return [IsoCountryCodeInstance] Fetched IsoCountryCodeInstance
|
|
86
|
+
def fetch_with_metadata
|
|
87
|
+
|
|
88
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
95
|
+
iso_country_code_instance = IsoCountryCodeInstance.new(
|
|
96
|
+
@version,
|
|
97
|
+
response.body,
|
|
98
|
+
iso_country_code: @solution[:iso_country_code],
|
|
99
|
+
short_code: @solution[:short_code],
|
|
100
|
+
)
|
|
101
|
+
IsoCountryCodeInstanceMetadata.new(
|
|
102
|
+
@version,
|
|
103
|
+
iso_country_code_instance,
|
|
104
|
+
response.headers,
|
|
105
|
+
response.status_code
|
|
106
|
+
)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
# Update the IsoCountryCodeInstance
|
|
111
|
+
# @param [String] messaging_region The Processing Region used for this short code for messaging
|
|
112
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
113
|
+
# @return [IsoCountryCodeInstance] Updated IsoCountryCodeInstance
|
|
114
|
+
def update(
|
|
115
|
+
messaging_region: :unset,
|
|
116
|
+
friendly_name: :unset
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
data = Twilio::Values.of({
|
|
120
|
+
'messagingRegion' => messaging_region,
|
|
121
|
+
'friendlyName' => friendly_name,
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
payload = @version.update('POST', @uri, data: data, headers: headers)
|
|
131
|
+
IsoCountryCodeInstance.new(
|
|
132
|
+
@version,
|
|
133
|
+
payload,
|
|
134
|
+
iso_country_code: @solution[:iso_country_code],
|
|
135
|
+
short_code: @solution[:short_code],
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
##
|
|
140
|
+
# Update the IsoCountryCodeInstanceMetadata
|
|
141
|
+
# @param [String] messaging_region The Processing Region used for this short code for messaging
|
|
142
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
143
|
+
# @return [IsoCountryCodeInstance] Updated IsoCountryCodeInstance
|
|
144
|
+
def update_with_metadata(
|
|
145
|
+
messaging_region: :unset,
|
|
146
|
+
friendly_name: :unset
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
data = Twilio::Values.of({
|
|
150
|
+
'messagingRegion' => messaging_region,
|
|
151
|
+
'friendlyName' => friendly_name,
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
response = @version.update_with_metadata('POST', @uri, data: data, headers: headers)
|
|
161
|
+
iso_country_code_instance = IsoCountryCodeInstance.new(
|
|
162
|
+
@version,
|
|
163
|
+
response.body,
|
|
164
|
+
iso_country_code: @solution[:iso_country_code],
|
|
165
|
+
short_code: @solution[:short_code],
|
|
166
|
+
)
|
|
167
|
+
IsoCountryCodeInstanceMetadata.new(
|
|
168
|
+
@version,
|
|
169
|
+
iso_country_code_instance,
|
|
170
|
+
response.headers,
|
|
171
|
+
response.status_code
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
##
|
|
177
|
+
# Provide a user friendly representation
|
|
178
|
+
def to_s
|
|
179
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
180
|
+
"#<Twilio.Routes.V3.IsoCountryCodeContext #{context}>"
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
##
|
|
184
|
+
# Provide a detailed, user friendly representation
|
|
185
|
+
def inspect
|
|
186
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
187
|
+
"#<Twilio.Routes.V3.IsoCountryCodeContext #{context}>"
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
class IsoCountryCodeInstanceMetadata < InstanceResourceMetadata
|
|
192
|
+
##
|
|
193
|
+
# Initializes a new IsoCountryCodeInstanceMetadata.
|
|
194
|
+
# @param [Version] version Version that contains the resource
|
|
195
|
+
# @param [}IsoCountryCodeInstance] iso_country_code_instance The instance associated with the metadata.
|
|
196
|
+
# @param [Hash] headers Header object with response headers.
|
|
197
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
198
|
+
# @return [IsoCountryCodeInstanceMetadata] The initialized instance with metadata.
|
|
199
|
+
def initialize(version, iso_country_code_instance, headers, status_code)
|
|
200
|
+
super(version, headers, status_code)
|
|
201
|
+
@iso_country_code_instance = iso_country_code_instance
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def iso_country_code
|
|
205
|
+
@iso_country_code_instance
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def headers
|
|
209
|
+
@headers
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
def status_code
|
|
213
|
+
@status_code
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def to_s
|
|
217
|
+
"<Twilio.Api.V2010.IsoCountryCodeInstanceMetadata status=#{@status_code}>"
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
class IsoCountryCodeListResponse < InstanceListResource
|
|
222
|
+
# @param [Array<IsoCountryCodeInstance>] instance
|
|
223
|
+
# @param [Hash{String => Object}] headers
|
|
224
|
+
# @param [Integer] status_code
|
|
225
|
+
def initialize(version, payload, key)
|
|
226
|
+
@iso_country_code_instance = payload.body[key].map do |data|
|
|
227
|
+
IsoCountryCodeInstance.new(version, data)
|
|
228
|
+
end
|
|
229
|
+
@headers = payload.headers
|
|
230
|
+
@status_code = payload.status_code
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
def iso_country_code_instance
|
|
234
|
+
@instance
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
class IsoCountryCodePage < TokenPage
|
|
239
|
+
##
|
|
240
|
+
# Initialize the IsoCountryCodePage
|
|
241
|
+
# @param [Version] version Version that contains the resource
|
|
242
|
+
# @param [Response] response Response from the API
|
|
243
|
+
# @param [Hash] solution Path solution for the resource
|
|
244
|
+
# @return [IsoCountryCodePage] IsoCountryCodePage
|
|
245
|
+
def initialize(version, response, solution)
|
|
246
|
+
|
|
247
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
248
|
+
super(apiV1Version, response)
|
|
249
|
+
|
|
250
|
+
# Path Solution
|
|
251
|
+
@solution = solution
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
##
|
|
255
|
+
# Build an instance of IsoCountryCodeInstance
|
|
256
|
+
# @param [Hash] payload Payload response from the API
|
|
257
|
+
# @return [IsoCountryCodeInstance] IsoCountryCodeInstance
|
|
258
|
+
def get_instance(payload)
|
|
259
|
+
IsoCountryCodeInstance.new(@version, payload)
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
##
|
|
263
|
+
# Provide a user friendly representation
|
|
264
|
+
def to_s
|
|
265
|
+
'<Twilio.Routes.V3.IsoCountryCodePage>'
|
|
266
|
+
end
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
class IsoCountryCodeInstance < InstanceResource
|
|
270
|
+
##
|
|
271
|
+
# Initialize the IsoCountryCodeInstance
|
|
272
|
+
# @param [Version] version Version that contains the resource
|
|
273
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
274
|
+
# @param [String] account_sid The SID of the
|
|
275
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this IsoCountryCode
|
|
276
|
+
# resource.
|
|
277
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
278
|
+
# @return [IsoCountryCodeInstance] IsoCountryCodeInstance
|
|
279
|
+
def initialize(version, payload , iso_country_code: nil, short_code: nil)
|
|
280
|
+
|
|
281
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
282
|
+
super(apiV1Version)
|
|
283
|
+
|
|
284
|
+
# Marshaled Properties
|
|
285
|
+
@properties = {
|
|
286
|
+
'iso_country_code' => payload['iso_country_code'],
|
|
287
|
+
'short_code' => payload['short_code'],
|
|
288
|
+
'url' => payload['url'],
|
|
289
|
+
'account_sid' => payload['account_sid'],
|
|
290
|
+
'friendly_name' => payload['friendly_name'],
|
|
291
|
+
'messaging_region' => payload['messaging_region'],
|
|
292
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
293
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
# Context
|
|
297
|
+
@instance_context = nil
|
|
298
|
+
@params = { 'iso_country_code' => iso_country_code || @properties['iso_country_code'] ,'short_code' => short_code || @properties['short_code'] , }
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
##
|
|
302
|
+
# Generate an instance context for the instance, the context is capable of
|
|
303
|
+
# performing various actions. All instance actions are proxied to the context
|
|
304
|
+
# @return [IsoCountryCodeContext] CallContext for this CallInstance
|
|
305
|
+
def context
|
|
306
|
+
unless @instance_context
|
|
307
|
+
@instance_context = IsoCountryCodeContext.new(@version , @params['iso_country_code'], @params['short_code'])
|
|
308
|
+
end
|
|
309
|
+
@instance_context
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
##
|
|
313
|
+
# @return [String] The ISO country code of the short code
|
|
314
|
+
def iso_country_code
|
|
315
|
+
@properties['iso_country_code']
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
##
|
|
319
|
+
# @return [String] The short code
|
|
320
|
+
def short_code
|
|
321
|
+
@properties['short_code']
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
##
|
|
325
|
+
# @return [String] The absolute URL of the resource.
|
|
326
|
+
def url
|
|
327
|
+
@properties['url']
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
##
|
|
331
|
+
# @return [String] The unique SID identifier of the Account.
|
|
332
|
+
def account_sid
|
|
333
|
+
@properties['account_sid']
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
##
|
|
337
|
+
# @return [String] A human readable description of the Inbound Processing Region assignment for this short code, up to 64 characters.
|
|
338
|
+
def friendly_name
|
|
339
|
+
@properties['friendly_name']
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
##
|
|
343
|
+
# @return [String] The Inbound Processing Region used for this short code for messaging.
|
|
344
|
+
def messaging_region
|
|
345
|
+
@properties['messaging_region']
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
##
|
|
349
|
+
# @return [Time] The date that this short code was assigned an Inbound Processing Region, given in ISO 8601 format.
|
|
350
|
+
def date_created
|
|
351
|
+
@properties['date_created']
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
##
|
|
355
|
+
# @return [Time] The date that the Inbound Processing Region was updated for this short code, given in ISO 8601 format.
|
|
356
|
+
def date_updated
|
|
357
|
+
@properties['date_updated']
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
##
|
|
361
|
+
# Fetch the IsoCountryCodeInstance
|
|
362
|
+
# @return [IsoCountryCodeInstance] Fetched IsoCountryCodeInstance
|
|
363
|
+
def fetch
|
|
364
|
+
|
|
365
|
+
context.fetch
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
##
|
|
369
|
+
# Update the IsoCountryCodeInstance
|
|
370
|
+
# @param [String] messaging_region The Processing Region used for this short code for messaging
|
|
371
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
372
|
+
# @return [IsoCountryCodeInstance] Updated IsoCountryCodeInstance
|
|
373
|
+
def update(
|
|
374
|
+
messaging_region: :unset,
|
|
375
|
+
friendly_name: :unset
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
context.update(
|
|
379
|
+
messaging_region: messaging_region,
|
|
380
|
+
friendly_name: friendly_name,
|
|
381
|
+
)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
##
|
|
385
|
+
# Provide a user friendly representation
|
|
386
|
+
def to_s
|
|
387
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
388
|
+
"<Twilio.Routes.V3.IsoCountryCodeInstance #{values}>"
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
##
|
|
392
|
+
# Provide a detailed, user friendly representation
|
|
393
|
+
def inspect
|
|
394
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
395
|
+
"<Twilio.Routes.V3.IsoCountryCodeInstance #{values}>"
|
|
396
|
+
end
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
end
|
|
400
|
+
end
|
|
401
|
+
end
|
|
402
|
+
end
|