twilio-ruby 7.10.7 → 7.11.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/.github/workflows/test-and-deploy.yml +43 -67
- data/.gitignore +0 -1
- data/CHANGES.md +46 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +154 -0
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/twilio-ruby/rest/accounts/v1/auth_token_promotion.rb +25 -6
- data/lib/twilio-ruby/rest/accounts/v1/secondary_auth_token.rb +48 -12
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +6 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +56 -2
- data/lib/twilio-ruby/rest/client.rb +0 -5
- data/lib/twilio-ruby/rest/content/v1/content/approval_create.rb +11 -1
- data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +10 -10
- data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +10 -10
- data/lib/twilio-ruby/rest/conversations/v2/action.rb +2 -2
- data/lib/twilio-ruby/rest/conversations/v2/communication.rb +43 -21
- data/lib/twilio-ruby/rest/conversations/v2/configuration.rb +59 -21
- data/lib/twilio-ruby/rest/conversations/v2/conversation.rb +28 -28
- data/lib/twilio-ruby/rest/conversations/v2/operation.rb +10 -10
- data/lib/twilio-ruby/rest/conversations/v2/participant.rb +58 -58
- data/lib/twilio-ruby/rest/conversations/v2.rb +45 -45
- data/lib/twilio-ruby/rest/iam/v1/new_api_key.rb +2 -2
- data/lib/twilio-ruby/rest/iam/v1/o_auth_app.rb +15 -2
- data/lib/twilio-ruby/rest/iam_base.rb +6 -1
- data/lib/twilio-ruby/rest/insights/v1/call/call_summary.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v1/call/event.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +7 -0
- data/lib/twilio-ruby/rest/insights/v3/metadata.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v3/query.rb +1 -1
- data/lib/twilio-ruby/rest/insights/v3.rb +1 -1
- data/lib/twilio-ruby/rest/intelligence/v3/conversation.rb +8 -8
- data/lib/twilio-ruby/rest/intelligence/v3/rule_execution.rb +502 -0
- data/lib/twilio-ruby/rest/intelligence/v3.rb +6 -0
- data/lib/twilio-ruby/rest/knowledge/v2/chunk.rb +28 -0
- data/lib/twilio-ruby/rest/knowledge/v2/knowledge.rb +38 -0
- data/lib/twilio-ruby/rest/knowledge/v2/search.rb +8 -117
- data/lib/twilio-ruby/rest/knowledge/v2.rb +1 -2
- data/lib/twilio-ruby/rest/memory/v1/bulk.rb +9 -118
- data/lib/twilio-ruby/rest/memory/v1/conversation_summary.rb +13 -5
- data/lib/twilio-ruby/rest/memory/v1/data_mapping.rb +6 -12
- data/lib/twilio-ruby/rest/memory/v1/identifier.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/identity_resolution_setting.rb +11 -132
- data/lib/twilio-ruby/rest/memory/v1/import.rb +28 -5
- data/lib/twilio-ruby/rest/memory/v1/lookup.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/observation.rb +70 -18
- data/lib/twilio-ruby/rest/memory/v1/operation.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/profile.rb +2 -2
- data/lib/twilio-ruby/rest/memory/v1/recall.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/revision.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/store.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/trait.rb +1 -1
- data/lib/twilio-ruby/rest/memory/v1/trait_group.rb +56 -6
- data/lib/twilio-ruby/rest/memory/v1.rb +3 -46
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +0 -18
- data/lib/twilio-ruby/rest/messaging/v2/channels_sender.rb +23 -4
- data/lib/twilio-ruby/rest/messaging/v3/typing_indicator.rb +4 -4
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification.rb +231 -0
- data/lib/twilio-ruby/rest/numbers/v1/sms_verification_check.rb +238 -0
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification.rb +245 -0
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification_check.rb +224 -0
- data/lib/twilio-ruby/rest/numbers/v1.rb +24 -0
- data/lib/twilio-ruby/rest/{assistants/v1/session.rb → numbers/v2/caller_id.rb} +141 -127
- data/lib/twilio-ruby/rest/numbers/v2.rb +16 -0
- data/lib/twilio-ruby/rest/oauth/v2/authorize.rb +14 -2
- data/lib/twilio-ruby/rest/oauth/v2/oauth_authorization_server.rb +259 -0
- data/lib/twilio-ruby/rest/oauth/v2/token.rb +8 -2
- data/lib/twilio-ruby/rest/preview_iam/versionless/organization.rb +0 -19
- data/lib/twilio-ruby/rest/routes/v3/phone_number.rb +465 -0
- data/lib/twilio-ruby/rest/routes/v3.rb +50 -0
- data/lib/twilio-ruby/rest/routes_base.rb +6 -1
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_brand_registration.rb +330 -0
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_brand_registration_embedded_session.rb +233 -0
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_campaign_registration.rb +321 -0
- data/lib/twilio-ruby/rest/trusthub/v1/a2p_campaign_registration_embedded_session.rb +233 -0
- data/lib/twilio-ruby/rest/trusthub/v1/customer_profiles_provisional_copy.rb +445 -0
- data/lib/twilio-ruby/rest/trusthub/v1/trust_products_provisional_copy.rb +445 -0
- data/lib/twilio-ruby/rest/trusthub/v1.rb +74 -0
- data/lib/twilio-ruby/rest/voice/v2/account_default_configuration.rb +556 -0
- data/lib/twilio-ruby/rest/voice/v2/configuration/default.rb +356 -0
- data/lib/twilio-ruby/rest/voice/v2/configuration.rb +412 -0
- data/lib/twilio-ruby/rest/voice/v2/recording.rb +616 -0
- data/lib/twilio-ruby/rest/voice/v2/transcription.rb +591 -0
- data/lib/twilio-ruby/rest/voice/v2/type.rb +518 -0
- data/lib/twilio-ruby/rest/voice/v2.rb +141 -0
- data/lib/twilio-ruby/rest/voice_base.rb +5 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +6 -68
- data/lib/twilio-ruby/version.rb +1 -1
- data/twilio-ruby.gemspec +1 -1
- metadata +33 -21
- data/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb +0 -558
- data/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb +0 -558
- data/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb +0 -431
- data/lib/twilio-ruby/rest/assistants/v1/assistant/message.rb +0 -296
- data/lib/twilio-ruby/rest/assistants/v1/assistant.rb +0 -927
- data/lib/twilio-ruby/rest/assistants/v1/knowledge/chunk.rb +0 -325
- data/lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb +0 -349
- data/lib/twilio-ruby/rest/assistants/v1/knowledge.rb +0 -871
- data/lib/twilio-ruby/rest/assistants/v1/policy.rb +0 -364
- data/lib/twilio-ruby/rest/assistants/v1/session/message.rb +0 -360
- data/lib/twilio-ruby/rest/assistants/v1/tool.rb +0 -847
- data/lib/twilio-ruby/rest/assistants/v1.rb +0 -104
- data/lib/twilio-ruby/rest/assistants.rb +0 -6
- data/lib/twilio-ruby/rest/assistants_base.rb +0 -38
|
@@ -0,0 +1,465 @@
|
|
|
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 PhoneNumberList < ListResource
|
|
21
|
+
|
|
22
|
+
##
|
|
23
|
+
# Initialize the PhoneNumberList
|
|
24
|
+
# @param [Version] version Version that contains the resource
|
|
25
|
+
# @return [PhoneNumberList] PhoneNumberList
|
|
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.PhoneNumberList>'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class PhoneNumberContext < InstanceContext
|
|
46
|
+
##
|
|
47
|
+
# Initialize the PhoneNumberContext
|
|
48
|
+
# @param [Version] version Version that contains the resource
|
|
49
|
+
# @param [String] phone_number The phone number in E.164 format
|
|
50
|
+
# @return [PhoneNumberContext] PhoneNumberContext
|
|
51
|
+
def initialize(version, phone_number)
|
|
52
|
+
|
|
53
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
54
|
+
super(apiV1Version)
|
|
55
|
+
|
|
56
|
+
# Path Solution
|
|
57
|
+
@solution = { phone_number: phone_number, }
|
|
58
|
+
@uri = "/PhoneNumbers/#{@solution[:phone_number]}"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
##
|
|
63
|
+
# Fetch the PhoneNumberInstance
|
|
64
|
+
# @return [PhoneNumberInstance] Fetched PhoneNumberInstance
|
|
65
|
+
def fetch
|
|
66
|
+
|
|
67
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
74
|
+
PhoneNumberInstance.new(
|
|
75
|
+
@version,
|
|
76
|
+
payload,
|
|
77
|
+
phone_number: @solution[:phone_number],
|
|
78
|
+
)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
##
|
|
82
|
+
# Fetch the PhoneNumberInstanceMetadata
|
|
83
|
+
# @return [PhoneNumberInstance] Fetched PhoneNumberInstance
|
|
84
|
+
def fetch_with_metadata
|
|
85
|
+
|
|
86
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
93
|
+
phone_number_instance = PhoneNumberInstance.new(
|
|
94
|
+
@version,
|
|
95
|
+
response.body,
|
|
96
|
+
phone_number: @solution[:phone_number],
|
|
97
|
+
)
|
|
98
|
+
PhoneNumberInstanceMetadata.new(
|
|
99
|
+
@version,
|
|
100
|
+
phone_number_instance,
|
|
101
|
+
response.headers,
|
|
102
|
+
response.status_code
|
|
103
|
+
)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
##
|
|
107
|
+
# Update the PhoneNumberInstance
|
|
108
|
+
# @param [String] voice_region The Inbound Processing Region used for this phone number for voice
|
|
109
|
+
# @param [String] messaging_region The Inbound Processing Region used for this phone number for messaging
|
|
110
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
111
|
+
# @return [PhoneNumberInstance] Updated PhoneNumberInstance
|
|
112
|
+
def update(
|
|
113
|
+
voice_region: :unset,
|
|
114
|
+
messaging_region: :unset,
|
|
115
|
+
friendly_name: :unset
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
data = Twilio::Values.of({
|
|
119
|
+
'voiceRegion' => voice_region,
|
|
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
|
+
PhoneNumberInstance.new(
|
|
132
|
+
@version,
|
|
133
|
+
payload,
|
|
134
|
+
phone_number: @solution[:phone_number],
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
##
|
|
139
|
+
# Update the PhoneNumberInstanceMetadata
|
|
140
|
+
# @param [String] voice_region The Inbound Processing Region used for this phone number for voice
|
|
141
|
+
# @param [String] messaging_region The Inbound Processing Region used for this phone number for messaging
|
|
142
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
143
|
+
# @return [PhoneNumberInstance] Updated PhoneNumberInstance
|
|
144
|
+
def update_with_metadata(
|
|
145
|
+
voice_region: :unset,
|
|
146
|
+
messaging_region: :unset,
|
|
147
|
+
friendly_name: :unset
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
data = Twilio::Values.of({
|
|
151
|
+
'voiceRegion' => voice_region,
|
|
152
|
+
'messagingRegion' => messaging_region,
|
|
153
|
+
'friendlyName' => friendly_name,
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
response = @version.update_with_metadata('POST', @uri, data: data, headers: headers)
|
|
163
|
+
phone_number_instance = PhoneNumberInstance.new(
|
|
164
|
+
@version,
|
|
165
|
+
response.body,
|
|
166
|
+
phone_number: @solution[:phone_number],
|
|
167
|
+
)
|
|
168
|
+
PhoneNumberInstanceMetadata.new(
|
|
169
|
+
@version,
|
|
170
|
+
phone_number_instance,
|
|
171
|
+
response.headers,
|
|
172
|
+
response.status_code
|
|
173
|
+
)
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
##
|
|
178
|
+
# Provide a user friendly representation
|
|
179
|
+
def to_s
|
|
180
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
181
|
+
"#<Twilio.Routes.V3.PhoneNumberContext #{context}>"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
##
|
|
185
|
+
# Provide a detailed, user friendly representation
|
|
186
|
+
def inspect
|
|
187
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
188
|
+
"#<Twilio.Routes.V3.PhoneNumberContext #{context}>"
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
class PhoneNumberInstanceMetadata < InstanceResourceMetadata
|
|
193
|
+
##
|
|
194
|
+
# Initializes a new PhoneNumberInstanceMetadata.
|
|
195
|
+
# @param [Version] version Version that contains the resource
|
|
196
|
+
# @param [}PhoneNumberInstance] phone_number_instance The instance associated with the metadata.
|
|
197
|
+
# @param [Hash] headers Header object with response headers.
|
|
198
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
199
|
+
# @return [PhoneNumberInstanceMetadata] The initialized instance with metadata.
|
|
200
|
+
def initialize(version, phone_number_instance, headers, status_code)
|
|
201
|
+
super(version, headers, status_code)
|
|
202
|
+
@phone_number_instance = phone_number_instance
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
def phone_number
|
|
206
|
+
@phone_number_instance
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def headers
|
|
210
|
+
@headers
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def status_code
|
|
214
|
+
@status_code
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def to_s
|
|
218
|
+
"<Twilio.Api.V2010.PhoneNumberInstanceMetadata status=#{@status_code}>"
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class PhoneNumberListResponse < InstanceListResource
|
|
223
|
+
# @param [Array<PhoneNumberInstance>] instance
|
|
224
|
+
# @param [Hash{String => Object}] headers
|
|
225
|
+
# @param [Integer] status_code
|
|
226
|
+
def initialize(version, payload, key)
|
|
227
|
+
@phone_number_instance = payload.body[key].map do |data|
|
|
228
|
+
PhoneNumberInstance.new(version, data)
|
|
229
|
+
end
|
|
230
|
+
@headers = payload.headers
|
|
231
|
+
@status_code = payload.status_code
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def phone_number_instance
|
|
235
|
+
@instance
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
class PhoneNumberPage < TokenPage
|
|
240
|
+
##
|
|
241
|
+
# Initialize the PhoneNumberPage
|
|
242
|
+
# @param [Version] version Version that contains the resource
|
|
243
|
+
# @param [Response] response Response from the API
|
|
244
|
+
# @param [Hash] solution Path solution for the resource
|
|
245
|
+
# @return [PhoneNumberPage] PhoneNumberPage
|
|
246
|
+
def initialize(version, response, solution)
|
|
247
|
+
|
|
248
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
249
|
+
super(apiV1Version, response)
|
|
250
|
+
|
|
251
|
+
# Path Solution
|
|
252
|
+
@solution = solution
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
##
|
|
256
|
+
# Build an instance of PhoneNumberInstance
|
|
257
|
+
# @param [Hash] payload Payload response from the API
|
|
258
|
+
# @return [PhoneNumberInstance] PhoneNumberInstance
|
|
259
|
+
def get_instance(payload)
|
|
260
|
+
PhoneNumberInstance.new(@version, payload)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
##
|
|
264
|
+
# Provide a user friendly representation
|
|
265
|
+
def to_s
|
|
266
|
+
'<Twilio.Routes.V3.PhoneNumberPage>'
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class PhoneNumberPageMetadata < PageMetadata
|
|
271
|
+
attr_reader :phone_number_page
|
|
272
|
+
|
|
273
|
+
def initialize(version, response, solution, limit)
|
|
274
|
+
super(version, response)
|
|
275
|
+
@phone_number_page = []
|
|
276
|
+
@limit = limit
|
|
277
|
+
key = get_key(response.body)
|
|
278
|
+
records = 0
|
|
279
|
+
while( limit != :unset && records < limit )
|
|
280
|
+
@phone_number_page << PhoneNumberListResponse.new(version, @payload, key, limit - records)
|
|
281
|
+
@payload = self.next_page
|
|
282
|
+
break unless @payload
|
|
283
|
+
records += (@payload.body[key] || []).size
|
|
284
|
+
end
|
|
285
|
+
# Path Solution
|
|
286
|
+
@solution = solution
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def each
|
|
290
|
+
@phone_number_page.each do |record|
|
|
291
|
+
yield record
|
|
292
|
+
end
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def to_s
|
|
296
|
+
'<Twilio::REST::Routes::V3PageMetadata>';
|
|
297
|
+
end
|
|
298
|
+
end
|
|
299
|
+
class PhoneNumberListResponse < InstanceListResource
|
|
300
|
+
|
|
301
|
+
# @param [Array<PhoneNumberInstance>] instance
|
|
302
|
+
# @param [Hash{String => Object}] headers
|
|
303
|
+
# @param [Integer] status_code
|
|
304
|
+
def initialize(version, payload, key, limit = :unset)
|
|
305
|
+
data_list = payload.body[key] || []
|
|
306
|
+
if limit != :unset
|
|
307
|
+
data_list = data_list[0, limit]
|
|
308
|
+
end
|
|
309
|
+
@phone_number = data_list.map do |data|
|
|
310
|
+
PhoneNumberInstance.new(version, data)
|
|
311
|
+
end
|
|
312
|
+
@headers = payload.headers
|
|
313
|
+
@status_code = payload.status_code
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
def phone_number
|
|
317
|
+
@phone_number
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def headers
|
|
321
|
+
@headers
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
def status_code
|
|
325
|
+
@status_code
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
class PhoneNumberInstance < InstanceResource
|
|
330
|
+
##
|
|
331
|
+
# Initialize the PhoneNumberInstance
|
|
332
|
+
# @param [Version] version Version that contains the resource
|
|
333
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
334
|
+
# @param [String] account_sid The SID of the
|
|
335
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this PhoneNumber
|
|
336
|
+
# resource.
|
|
337
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
338
|
+
# @return [PhoneNumberInstance] PhoneNumberInstance
|
|
339
|
+
def initialize(version, payload , phone_number: nil)
|
|
340
|
+
|
|
341
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
342
|
+
super(apiV1Version)
|
|
343
|
+
|
|
344
|
+
# Marshaled Properties
|
|
345
|
+
@properties = {
|
|
346
|
+
'phone_number' => payload['phone_number'],
|
|
347
|
+
'url' => payload['url'],
|
|
348
|
+
'account_sid' => payload['account_sid'],
|
|
349
|
+
'friendly_name' => payload['friendly_name'],
|
|
350
|
+
'voice_region' => payload['voice_region'],
|
|
351
|
+
'messaging_region' => payload['messaging_region'],
|
|
352
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
353
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
# Context
|
|
357
|
+
@instance_context = nil
|
|
358
|
+
@params = { 'phone_number' => phone_number || @properties['phone_number'] , }
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
##
|
|
362
|
+
# Generate an instance context for the instance, the context is capable of
|
|
363
|
+
# performing various actions. All instance actions are proxied to the context
|
|
364
|
+
# @return [PhoneNumberContext] CallContext for this CallInstance
|
|
365
|
+
def context
|
|
366
|
+
unless @instance_context
|
|
367
|
+
@instance_context = PhoneNumberContext.new(@version , @params['phone_number'])
|
|
368
|
+
end
|
|
369
|
+
@instance_context
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
##
|
|
373
|
+
# @return [String] The phone number in E.164 format
|
|
374
|
+
def phone_number
|
|
375
|
+
@properties['phone_number']
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
##
|
|
379
|
+
# @return [String] The absolute URL of the resource.
|
|
380
|
+
def url
|
|
381
|
+
@properties['url']
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
##
|
|
385
|
+
# @return [String] The unique SID identifier of the Account.
|
|
386
|
+
def account_sid
|
|
387
|
+
@properties['account_sid']
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
##
|
|
391
|
+
# @return [String] A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters.
|
|
392
|
+
def friendly_name
|
|
393
|
+
@properties['friendly_name']
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
##
|
|
397
|
+
# @return [String] The Inbound Processing Region used for this phone number for voice.
|
|
398
|
+
def voice_region
|
|
399
|
+
@properties['voice_region']
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
##
|
|
403
|
+
# @return [String] The Inbound Processing Region used for this phone number for messaging.
|
|
404
|
+
def messaging_region
|
|
405
|
+
@properties['messaging_region']
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
##
|
|
409
|
+
# @return [Time] The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format.
|
|
410
|
+
def date_created
|
|
411
|
+
@properties['date_created']
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
##
|
|
415
|
+
# @return [Time] The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format.
|
|
416
|
+
def date_updated
|
|
417
|
+
@properties['date_updated']
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
##
|
|
421
|
+
# Fetch the PhoneNumberInstance
|
|
422
|
+
# @return [PhoneNumberInstance] Fetched PhoneNumberInstance
|
|
423
|
+
def fetch
|
|
424
|
+
|
|
425
|
+
context.fetch
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
##
|
|
429
|
+
# Update the PhoneNumberInstance
|
|
430
|
+
# @param [String] voice_region The Inbound Processing Region used for this phone number for voice
|
|
431
|
+
# @param [String] messaging_region The Inbound Processing Region used for this phone number for messaging
|
|
432
|
+
# @param [String] friendly_name A human readable description of this resource, up to 64 characters.
|
|
433
|
+
# @return [PhoneNumberInstance] Updated PhoneNumberInstance
|
|
434
|
+
def update(
|
|
435
|
+
voice_region: :unset,
|
|
436
|
+
messaging_region: :unset,
|
|
437
|
+
friendly_name: :unset
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
context.update(
|
|
441
|
+
voice_region: voice_region,
|
|
442
|
+
messaging_region: messaging_region,
|
|
443
|
+
friendly_name: friendly_name,
|
|
444
|
+
)
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
##
|
|
448
|
+
# Provide a user friendly representation
|
|
449
|
+
def to_s
|
|
450
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
451
|
+
"<Twilio.Routes.V3.PhoneNumberInstance #{values}>"
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
##
|
|
455
|
+
# Provide a detailed, user friendly representation
|
|
456
|
+
def inspect
|
|
457
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
458
|
+
"<Twilio.Routes.V3.PhoneNumberInstance #{values}>"
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
module Twilio
|
|
16
|
+
module REST
|
|
17
|
+
class Routes
|
|
18
|
+
class V3 < Version
|
|
19
|
+
##
|
|
20
|
+
# Initialize the V3 version of Routes
|
|
21
|
+
def initialize(domain)
|
|
22
|
+
super
|
|
23
|
+
@version = 'v3'
|
|
24
|
+
@phone_numbers = nil
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# @param [String] phone_number The phone number in E.164 format
|
|
29
|
+
# @return [Twilio::REST::Routes::V3::PhoneNumberContext] if phoneNumber was passed.
|
|
30
|
+
# @return [Twilio::REST::Routes::V3::PhoneNumberList]
|
|
31
|
+
def phone_numbers(phone_number=:unset)
|
|
32
|
+
if phone_number.nil?
|
|
33
|
+
raise ArgumentError, 'phone_number cannot be nil'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if phone_number == :unset
|
|
37
|
+
@phone_numbers ||= PhoneNumberList.new self
|
|
38
|
+
else
|
|
39
|
+
PhoneNumberContext.new(self, phone_number)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
##
|
|
43
|
+
# Provide a user friendly representation
|
|
44
|
+
def to_s
|
|
45
|
+
'<Twilio::REST::Routes::V3>';
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -22,16 +22,21 @@ module Twilio
|
|
|
22
22
|
@host = "routes.twilio.com"
|
|
23
23
|
@port = 443
|
|
24
24
|
@v2 = nil
|
|
25
|
+
@v3 = nil
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def v2
|
|
28
29
|
@v2 ||= Routes::V2.new self
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
def v3
|
|
33
|
+
@v3 ||= Routes::V3.new self
|
|
34
|
+
end
|
|
35
|
+
|
|
31
36
|
##
|
|
32
37
|
# Provide a user friendly representation
|
|
33
38
|
def to_s
|
|
34
|
-
'<Twilio::REST::Routes
|
|
39
|
+
'<Twilio::REST::Routes>';
|
|
35
40
|
end
|
|
36
41
|
end
|
|
37
42
|
end
|