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,518 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio API definition for public-api voice
|
|
8
|
+
# Powers Twilio public-api voice
|
|
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 Voice < VoiceBase
|
|
19
|
+
class V2 < Version
|
|
20
|
+
class TypeList < ListResource
|
|
21
|
+
|
|
22
|
+
class VoiceV2ConfigurationRequest
|
|
23
|
+
# @param [unique_name]: [String] The unique name
|
|
24
|
+
# @param [description]: [String] The description
|
|
25
|
+
# @param [configuration]: [Hash]
|
|
26
|
+
attr_accessor :unique_name, :description, :configuration
|
|
27
|
+
def initialize(payload)
|
|
28
|
+
@unique_name = payload["unique_name"]
|
|
29
|
+
@description = payload["description"]
|
|
30
|
+
@configuration = payload["configuration"]
|
|
31
|
+
end
|
|
32
|
+
def to_json(options = {})
|
|
33
|
+
{
|
|
34
|
+
"unique_name": @unique_name,
|
|
35
|
+
"description": @description,
|
|
36
|
+
"configuration": @configuration,
|
|
37
|
+
}.to_json(options)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Initialize the TypeList
|
|
44
|
+
# @param [Version] version Version that contains the resource
|
|
45
|
+
# @return [TypeList] TypeList
|
|
46
|
+
def initialize(version)
|
|
47
|
+
super(version)
|
|
48
|
+
|
|
49
|
+
# Path Solution
|
|
50
|
+
@solution = { }
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# Provide a user friendly representation
|
|
58
|
+
def to_s
|
|
59
|
+
'#<Twilio.Voice.V2.TypeList>'
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class TypeContext < InstanceContext
|
|
65
|
+
##
|
|
66
|
+
# Initialize the TypeContext
|
|
67
|
+
# @param [Version] version Version that contains the resource
|
|
68
|
+
# @param [String] type
|
|
69
|
+
# @param [String] id_or_unique_name
|
|
70
|
+
# @return [TypeContext] TypeContext
|
|
71
|
+
def initialize(version, type, id_or_unique_name)
|
|
72
|
+
super(version)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# Path Solution
|
|
76
|
+
@solution = { type: type, id_or_unique_name: id_or_unique_name, }
|
|
77
|
+
@uri = "/Configurations/#{@solution[:type]}/#{@solution[:id_or_unique_name]}"
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
##
|
|
82
|
+
# Delete the TypeInstance
|
|
83
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
84
|
+
def delete
|
|
85
|
+
|
|
86
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@version.delete('DELETE', @uri, headers: headers)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
##
|
|
95
|
+
# Delete the TypeInstanceMetadata
|
|
96
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
97
|
+
def delete_with_metadata
|
|
98
|
+
|
|
99
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
response = @version.delete_with_metadata('DELETE', @uri, headers: headers)
|
|
104
|
+
type_instance = TypeInstance.new(
|
|
105
|
+
@version,
|
|
106
|
+
response.body,
|
|
107
|
+
account_sid: @solution[:account_sid],
|
|
108
|
+
sid: @solution[:sid],
|
|
109
|
+
)
|
|
110
|
+
TypeInstanceMetadata.new(@version, type_instance, response.headers, response.status_code)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
##
|
|
114
|
+
# Fetch the TypeInstance
|
|
115
|
+
# @return [TypeInstance] Fetched TypeInstance
|
|
116
|
+
def fetch
|
|
117
|
+
|
|
118
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
125
|
+
TypeInstance.new(
|
|
126
|
+
@version,
|
|
127
|
+
payload,
|
|
128
|
+
type: @solution[:type],
|
|
129
|
+
id_or_unique_name: @solution[:id_or_unique_name],
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
##
|
|
134
|
+
# Fetch the TypeInstanceMetadata
|
|
135
|
+
# @return [TypeInstance] Fetched TypeInstance
|
|
136
|
+
def fetch_with_metadata
|
|
137
|
+
|
|
138
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
145
|
+
type_instance = TypeInstance.new(
|
|
146
|
+
@version,
|
|
147
|
+
response.body,
|
|
148
|
+
type: @solution[:type],
|
|
149
|
+
id_or_unique_name: @solution[:id_or_unique_name],
|
|
150
|
+
)
|
|
151
|
+
TypeInstanceMetadata.new(
|
|
152
|
+
@version,
|
|
153
|
+
type_instance,
|
|
154
|
+
response.headers,
|
|
155
|
+
response.status_code
|
|
156
|
+
)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
##
|
|
160
|
+
# Update the TypeInstance
|
|
161
|
+
# @param [VoiceV2ConfigurationRequest] voice_v2_configuration_request
|
|
162
|
+
# @return [TypeInstance] Updated TypeInstance
|
|
163
|
+
def update(voice_v2_configuration_request: :unset
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
167
|
+
headers['Content-Type'] = 'application/json'
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
payload = @version.update('PUT', @uri, headers: headers, data: voice_v2_configuration_request.to_json)
|
|
173
|
+
TypeInstance.new(
|
|
174
|
+
@version,
|
|
175
|
+
payload,
|
|
176
|
+
type: @solution[:type],
|
|
177
|
+
id_or_unique_name: @solution[:id_or_unique_name],
|
|
178
|
+
)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
##
|
|
182
|
+
# Update the TypeInstanceMetadata
|
|
183
|
+
# @param [VoiceV2ConfigurationRequest] voice_v2_configuration_request
|
|
184
|
+
# @return [TypeInstance] Updated TypeInstance
|
|
185
|
+
def update_with_metadata(voice_v2_configuration_request: :unset
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
189
|
+
headers['Content-Type'] = 'application/json'
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
response = @version.update_with_metadata('PUT', @uri, headers: headers, data: voice_v2_configuration_request.to_json)
|
|
195
|
+
type_instance = TypeInstance.new(
|
|
196
|
+
@version,
|
|
197
|
+
response.body,
|
|
198
|
+
type: @solution[:type],
|
|
199
|
+
id_or_unique_name: @solution[:id_or_unique_name],
|
|
200
|
+
)
|
|
201
|
+
TypeInstanceMetadata.new(
|
|
202
|
+
@version,
|
|
203
|
+
type_instance,
|
|
204
|
+
response.headers,
|
|
205
|
+
response.status_code
|
|
206
|
+
)
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
##
|
|
211
|
+
# Provide a user friendly representation
|
|
212
|
+
def to_s
|
|
213
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
214
|
+
"#<Twilio.Voice.V2.TypeContext #{context}>"
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
##
|
|
218
|
+
# Provide a detailed, user friendly representation
|
|
219
|
+
def inspect
|
|
220
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
221
|
+
"#<Twilio.Voice.V2.TypeContext #{context}>"
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
class TypeInstanceMetadata < InstanceResourceMetadata
|
|
226
|
+
##
|
|
227
|
+
# Initializes a new TypeInstanceMetadata.
|
|
228
|
+
# @param [Version] version Version that contains the resource
|
|
229
|
+
# @param [}TypeInstance] type_instance The instance associated with the metadata.
|
|
230
|
+
# @param [Hash] headers Header object with response headers.
|
|
231
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
232
|
+
# @return [TypeInstanceMetadata] The initialized instance with metadata.
|
|
233
|
+
def initialize(version, type_instance, headers, status_code)
|
|
234
|
+
super(version, headers, status_code)
|
|
235
|
+
@type_instance = type_instance
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
def type
|
|
239
|
+
@type_instance
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def headers
|
|
243
|
+
@headers
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def status_code
|
|
247
|
+
@status_code
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def to_s
|
|
251
|
+
"<Twilio.Api.V2010.TypeInstanceMetadata status=#{@status_code}>"
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
class TypeListResponse < InstanceListResource
|
|
256
|
+
# @param [Array<TypeInstance>] instance
|
|
257
|
+
# @param [Hash{String => Object}] headers
|
|
258
|
+
# @param [Integer] status_code
|
|
259
|
+
def initialize(version, payload, key)
|
|
260
|
+
@type_instance = payload.body[key].map do |data|
|
|
261
|
+
TypeInstance.new(version, data)
|
|
262
|
+
end
|
|
263
|
+
@headers = payload.headers
|
|
264
|
+
@status_code = payload.status_code
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def type_instance
|
|
268
|
+
@instance
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
class TypePage < Page
|
|
273
|
+
##
|
|
274
|
+
# Initialize the TypePage
|
|
275
|
+
# @param [Version] version Version that contains the resource
|
|
276
|
+
# @param [Response] response Response from the API
|
|
277
|
+
# @param [Hash] solution Path solution for the resource
|
|
278
|
+
# @return [TypePage] TypePage
|
|
279
|
+
def initialize(version, response, solution)
|
|
280
|
+
super(version, response)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# Path Solution
|
|
284
|
+
@solution = solution
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
##
|
|
288
|
+
# Build an instance of TypeInstance
|
|
289
|
+
# @param [Hash] payload Payload response from the API
|
|
290
|
+
# @return [TypeInstance] TypeInstance
|
|
291
|
+
def get_instance(payload)
|
|
292
|
+
TypeInstance.new(@version, payload)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
##
|
|
296
|
+
# Provide a user friendly representation
|
|
297
|
+
def to_s
|
|
298
|
+
'<Twilio.Voice.V2.TypePage>'
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
class TypePageMetadata < PageMetadata
|
|
303
|
+
attr_reader :type_page
|
|
304
|
+
|
|
305
|
+
def initialize(version, response, solution, limit)
|
|
306
|
+
super(version, response)
|
|
307
|
+
@type_page = []
|
|
308
|
+
@limit = limit
|
|
309
|
+
key = get_key(response.body)
|
|
310
|
+
records = 0
|
|
311
|
+
while( limit != :unset && records < limit )
|
|
312
|
+
@type_page << TypeListResponse.new(version, @payload, key, limit - records)
|
|
313
|
+
@payload = self.next_page
|
|
314
|
+
break unless @payload
|
|
315
|
+
records += (@payload.body[key] || []).size
|
|
316
|
+
end
|
|
317
|
+
# Path Solution
|
|
318
|
+
@solution = solution
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def each
|
|
322
|
+
@type_page.each do |record|
|
|
323
|
+
yield record
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def to_s
|
|
328
|
+
'<Twilio::REST::Voice::V2PageMetadata>';
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
class TypeListResponse < InstanceListResource
|
|
332
|
+
|
|
333
|
+
# @param [Array<TypeInstance>] instance
|
|
334
|
+
# @param [Hash{String => Object}] headers
|
|
335
|
+
# @param [Integer] status_code
|
|
336
|
+
def initialize(version, payload, key, limit = :unset)
|
|
337
|
+
data_list = payload.body[key] || []
|
|
338
|
+
if limit != :unset
|
|
339
|
+
data_list = data_list[0, limit]
|
|
340
|
+
end
|
|
341
|
+
@type = data_list.map do |data|
|
|
342
|
+
TypeInstance.new(version, data)
|
|
343
|
+
end
|
|
344
|
+
@headers = payload.headers
|
|
345
|
+
@status_code = payload.status_code
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def type
|
|
349
|
+
@type
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def headers
|
|
353
|
+
@headers
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def status_code
|
|
357
|
+
@status_code
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
class TypeInstance < InstanceResource
|
|
362
|
+
##
|
|
363
|
+
# Initialize the TypeInstance
|
|
364
|
+
# @param [Version] version Version that contains the resource
|
|
365
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
366
|
+
# @param [String] account_sid The SID of the
|
|
367
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Type
|
|
368
|
+
# resource.
|
|
369
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
370
|
+
# @return [TypeInstance] TypeInstance
|
|
371
|
+
def initialize(version, payload , type: nil, id_or_unique_name: nil)
|
|
372
|
+
super(version)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
# Marshaled Properties
|
|
376
|
+
@properties = {
|
|
377
|
+
'message' => payload['message'],
|
|
378
|
+
'code' => payload['code'],
|
|
379
|
+
'status' => payload['status'],
|
|
380
|
+
'more_info' => payload['more_info'],
|
|
381
|
+
'id' => payload['id'],
|
|
382
|
+
'account_sid' => payload['account_sid'],
|
|
383
|
+
'unique_name' => payload['unique_name'],
|
|
384
|
+
'description' => payload['description'],
|
|
385
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
386
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
387
|
+
'configuration' => payload['configuration'],
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
# Context
|
|
391
|
+
@instance_context = nil
|
|
392
|
+
@params = { 'type' => type || @properties['type'] ,'id_or_unique_name' => id_or_unique_name || @properties['id_or_unique_name'] , }
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
##
|
|
396
|
+
# Generate an instance context for the instance, the context is capable of
|
|
397
|
+
# performing various actions. All instance actions are proxied to the context
|
|
398
|
+
# @return [TypeContext] CallContext for this CallInstance
|
|
399
|
+
def context
|
|
400
|
+
unless @instance_context
|
|
401
|
+
@instance_context = TypeContext.new(@version , @params['type'], @params['id_or_unique_name'])
|
|
402
|
+
end
|
|
403
|
+
@instance_context
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
##
|
|
407
|
+
# @return [String] Error message
|
|
408
|
+
def message
|
|
409
|
+
@properties['message']
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
##
|
|
413
|
+
# @return [String] Twilio error code
|
|
414
|
+
def code
|
|
415
|
+
@properties['code']
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
##
|
|
419
|
+
# @return [String] status code
|
|
420
|
+
def status
|
|
421
|
+
@properties['status']
|
|
422
|
+
end
|
|
423
|
+
|
|
424
|
+
##
|
|
425
|
+
# @return [String] More information about the error
|
|
426
|
+
def more_info
|
|
427
|
+
@properties['more_info']
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
##
|
|
431
|
+
# @return [String] Configuration Identifier
|
|
432
|
+
def id
|
|
433
|
+
@properties['id']
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
##
|
|
437
|
+
# @return [String] Account sid
|
|
438
|
+
def account_sid
|
|
439
|
+
@properties['account_sid']
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
##
|
|
443
|
+
# @return [String] The unique name
|
|
444
|
+
def unique_name
|
|
445
|
+
@properties['unique_name']
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
##
|
|
449
|
+
# @return [String] The description
|
|
450
|
+
def description
|
|
451
|
+
@properties['description']
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
##
|
|
455
|
+
# @return [Time]
|
|
456
|
+
def date_created
|
|
457
|
+
@properties['date_created']
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
##
|
|
461
|
+
# @return [Time]
|
|
462
|
+
def date_updated
|
|
463
|
+
@properties['date_updated']
|
|
464
|
+
end
|
|
465
|
+
|
|
466
|
+
##
|
|
467
|
+
# @return [Hash]
|
|
468
|
+
def configuration
|
|
469
|
+
@properties['configuration']
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
##
|
|
473
|
+
# Delete the TypeInstance
|
|
474
|
+
# @return [Boolean] True if delete succeeds, false otherwise
|
|
475
|
+
def delete
|
|
476
|
+
|
|
477
|
+
context.delete
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
##
|
|
481
|
+
# Fetch the TypeInstance
|
|
482
|
+
# @return [TypeInstance] Fetched TypeInstance
|
|
483
|
+
def fetch
|
|
484
|
+
|
|
485
|
+
context.fetch
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
##
|
|
489
|
+
# Update the TypeInstance
|
|
490
|
+
# @param [VoiceV2ConfigurationRequest] voice_v2_configuration_request
|
|
491
|
+
# @return [TypeInstance] Updated TypeInstance
|
|
492
|
+
def update(voice_v2_configuration_request: :unset
|
|
493
|
+
)
|
|
494
|
+
|
|
495
|
+
context.update(
|
|
496
|
+
voice_v2_configuration_request: voice_v2_configuration_request,
|
|
497
|
+
)
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
##
|
|
501
|
+
# Provide a user friendly representation
|
|
502
|
+
def to_s
|
|
503
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
504
|
+
"<Twilio.Voice.V2.TypeInstance #{values}>"
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
##
|
|
508
|
+
# Provide a detailed, user friendly representation
|
|
509
|
+
def inspect
|
|
510
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
511
|
+
"<Twilio.Voice.V2.TypeInstance #{values}>"
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
end
|
|
518
|
+
end
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio API definition for public-api voice
|
|
8
|
+
# Powers Twilio public-api voice
|
|
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 Voice
|
|
18
|
+
class V2 < Version
|
|
19
|
+
##
|
|
20
|
+
# Initialize the V2 version of Voice
|
|
21
|
+
def initialize(domain)
|
|
22
|
+
super
|
|
23
|
+
@version = 'v2'
|
|
24
|
+
@account_default_configuration = nil
|
|
25
|
+
@configurations = nil
|
|
26
|
+
@recording = nil
|
|
27
|
+
@transcription = nil
|
|
28
|
+
@type = nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# @param [String] type
|
|
33
|
+
# @return [Twilio::REST::Voice::V2::AccountDefaultConfigurationContext] if type was passed.
|
|
34
|
+
# @return [Twilio::REST::Voice::V2::AccountDefaultConfigurationList]
|
|
35
|
+
def account_default_configuration(type=:unset)
|
|
36
|
+
if type.nil?
|
|
37
|
+
raise ArgumentError, 'type cannot be nil'
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
if type == :unset
|
|
41
|
+
@account_default_configuration ||= AccountDefaultConfigurationList.new self
|
|
42
|
+
else
|
|
43
|
+
AccountDefaultConfigurationContext.new(self, type)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
##
|
|
47
|
+
# @param [String] type
|
|
48
|
+
# @return [Twilio::REST::Voice::V2::ConfigurationContext] if type was passed.
|
|
49
|
+
# @return [Twilio::REST::Voice::V2::ConfigurationList]
|
|
50
|
+
def configurations(type=:unset)
|
|
51
|
+
if type.nil?
|
|
52
|
+
raise ArgumentError, 'type cannot be nil'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
if type == :unset
|
|
56
|
+
@configurations ||= ConfigurationList.new self
|
|
57
|
+
else
|
|
58
|
+
ConfigurationContext.new(self, type)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
##
|
|
62
|
+
# @param [String] id_or_unique_name Config id or unique name
|
|
63
|
+
# @return [Twilio::REST::Voice::V2::RecordingContext] if idOrUniqueName was passed.
|
|
64
|
+
# @return [Twilio::REST::Voice::V2::RecordingList]
|
|
65
|
+
def recording(id_or_unique_name=:unset)
|
|
66
|
+
if id_or_unique_name.nil?
|
|
67
|
+
raise ArgumentError, 'id_or_unique_name cannot be nil'
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if id_or_unique_name == :unset
|
|
71
|
+
@recording ||= RecordingList.new self
|
|
72
|
+
else
|
|
73
|
+
RecordingContext.new(self, id_or_unique_name)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
##
|
|
77
|
+
# @param [String] id_or_unique_name Config id or unique name
|
|
78
|
+
# @return [Twilio::REST::Voice::V2::TranscriptionContext] if idOrUniqueName was passed.
|
|
79
|
+
# @return [Twilio::REST::Voice::V2::TranscriptionList]
|
|
80
|
+
def transcription(id_or_unique_name=:unset)
|
|
81
|
+
if id_or_unique_name.nil?
|
|
82
|
+
raise ArgumentError, 'id_or_unique_name cannot be nil'
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if id_or_unique_name == :unset
|
|
86
|
+
@transcription ||= TranscriptionList.new self
|
|
87
|
+
else
|
|
88
|
+
TranscriptionContext.new(self, id_or_unique_name)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
##
|
|
92
|
+
# @param [String] type
|
|
93
|
+
# @param [String] id_or_unique_name Config id or unique name
|
|
94
|
+
# @return [Twilio::REST::Voice::V2::TypeContext] if type was passed.
|
|
95
|
+
# @return [Twilio::REST::Voice::V2::TypeList]
|
|
96
|
+
def type(type=:unset, id_or_unique_name=:unset)
|
|
97
|
+
if type.nil?
|
|
98
|
+
raise ArgumentError, 'type cannot be nil'
|
|
99
|
+
end
|
|
100
|
+
if id_or_unique_name.nil?
|
|
101
|
+
raise ArgumentError, 'id_or_unique_name cannot be nil'
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if type == :unset && id_or_unique_name == :unset
|
|
105
|
+
@type ||= TypeList.new self
|
|
106
|
+
elsif type != :unset && id_or_unique_name == :unset
|
|
107
|
+
TypeList.new(self, type: type)
|
|
108
|
+
else
|
|
109
|
+
TypeContext.new(self, type, id_or_unique_name)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
##
|
|
113
|
+
# @param [String] type
|
|
114
|
+
# @param [String] id_or_unique_name Config id or unique name
|
|
115
|
+
# @return [Twilio::REST::Voice::V2::TypeContext] if idOrUniqueName was passed.
|
|
116
|
+
# @return [Twilio::REST::Voice::V2::TypeList]
|
|
117
|
+
def type(type=:unset, id_or_unique_name=:unset)
|
|
118
|
+
if type.nil?
|
|
119
|
+
raise ArgumentError, 'type cannot be nil'
|
|
120
|
+
end
|
|
121
|
+
if id_or_unique_name.nil?
|
|
122
|
+
raise ArgumentError, 'id_or_unique_name cannot be nil'
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if type == :unset && id_or_unique_name == :unset
|
|
126
|
+
@type ||= TypeList.new self
|
|
127
|
+
elsif type != :unset && id_or_unique_name == :unset
|
|
128
|
+
TypeList.new(self, type: type)
|
|
129
|
+
else
|
|
130
|
+
TypeContext.new(self, type, id_or_unique_name)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
##
|
|
134
|
+
# Provide a user friendly representation
|
|
135
|
+
def to_s
|
|
136
|
+
'<Twilio::REST::Voice::V2>';
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
@@ -22,6 +22,7 @@ module Twilio
|
|
|
22
22
|
@host = "voice.twilio.com"
|
|
23
23
|
@port = 443
|
|
24
24
|
@v1 = nil
|
|
25
|
+
@v2 = nil
|
|
25
26
|
@v3 = nil
|
|
26
27
|
end
|
|
27
28
|
|
|
@@ -29,6 +30,10 @@ module Twilio
|
|
|
29
30
|
@v1 ||= Voice::V1.new self
|
|
30
31
|
end
|
|
31
32
|
|
|
33
|
+
def v2
|
|
34
|
+
@v2 ||= Voice::V2.new self
|
|
35
|
+
end
|
|
36
|
+
|
|
32
37
|
def v3
|
|
33
38
|
@v3 ||= Voice::V3.new self
|
|
34
39
|
end
|