twilio-ruby 7.11.2 → 7.12.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/.github/workflows/test-and-deploy.yml +13 -1
- data/CHANGES.md +272 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/githooks/pre-commit +11 -0
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +2 -2
- data/lib/twilio-ruby/rest/content/v1/content.rb +2 -2
- 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 +14 -0
- data/lib/twilio-ruby/rest/conversations/v2/conversation.rb +133 -12
- 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 +774 -0
- data/lib/twilio-ruby/rest/{numbers/v1/voice_verification_check.rb → insights/v3/custom_field_mappings_capacity.rb} +44 -48
- data/lib/twilio-ruby/rest/insights/v3.rb +22 -0
- data/lib/twilio-ruby/rest/intelligence/v3/rule_execution.rb +33 -1
- data/lib/twilio-ruby/rest/memory/v1/conversation_summary.rb +5 -5
- data/lib/twilio-ruby/rest/memory/v1/data_mapping.rb +3 -3
- 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 +3 -3
- data/lib/twilio-ruby/rest/memory/v1/trait_group.rb +3 -3
- 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/verify/v2/service/entity/factor.rb +1 -1
- data/lib/twilio-ruby/rest/verify/v2/service/new_verify_factor.rb +1 -1
- data/lib/twilio-ruby/rest/voice/v2/recording_account_default_configuration.rb +547 -0
- data/lib/twilio-ruby/rest/voice/v2.rb +6 -0
- data/lib/twilio-ruby/twiml/voice_response.rb +12 -6
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +6 -3
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Twilio - Insights
|
|
8
|
+
# The Twilio Insights v3 API provides semantic query access to Conversations analytics data. Resources include synchronous Query, Metadata, and asynchronous QueryJobs for long-running queries.
|
|
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 Insights < InsightsBase
|
|
19
|
+
class V3 < Version
|
|
20
|
+
class CustomFieldMappingList < ListResource
|
|
21
|
+
|
|
22
|
+
class CustomFieldMappingRequest
|
|
23
|
+
# @param [category]: [MappingCategory]
|
|
24
|
+
# @param [name]: [String] Name of the custom field, used to reference it in Insights queries. Contains only letters, digits and `_`, and must not be empty. Must be unique within the account across every `sourceType`; registering an existing name returns `409`. Cannot be changed after registration.
|
|
25
|
+
# @param [description]: [String] Optional, free-text description of this custom field mapping, up to 150 characters. Display-only — not part of any uniqueness check.
|
|
26
|
+
# @param [entity_metadata]: [CustomFieldMappingList.EntityMetadata]
|
|
27
|
+
attr_accessor :category, :name, :description, :entity_metadata
|
|
28
|
+
def initialize(payload)
|
|
29
|
+
@category = payload["category"]
|
|
30
|
+
@name = payload["name"]
|
|
31
|
+
@description = payload["description"]
|
|
32
|
+
@entity_metadata = payload["entity_metadata"]
|
|
33
|
+
end
|
|
34
|
+
def to_json(options = {})
|
|
35
|
+
{
|
|
36
|
+
"category": @category,
|
|
37
|
+
"name": @name,
|
|
38
|
+
"description": @description,
|
|
39
|
+
"entityMetadata": @entity_metadata,
|
|
40
|
+
}.to_json(options)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class CustomFieldMappingUpdateRequest
|
|
45
|
+
# @param [entity_metadata]: [CustomFieldMappingList.EntityMetadataUpdate]
|
|
46
|
+
attr_accessor :entity_metadata
|
|
47
|
+
def initialize(payload)
|
|
48
|
+
@entity_metadata = payload["entity_metadata"]
|
|
49
|
+
end
|
|
50
|
+
def to_json(options = {})
|
|
51
|
+
{
|
|
52
|
+
"entityMetadata": @entity_metadata,
|
|
53
|
+
}.to_json(options)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
class EntityMetadataUpdate
|
|
58
|
+
# @param [source_type]: [SourceType]
|
|
59
|
+
# @param [intelligence_operator]: [CustomFieldMappingList.IntelligenceOperatorSourceUpdate]
|
|
60
|
+
attr_accessor :source_type, :intelligence_operator
|
|
61
|
+
def initialize(payload)
|
|
62
|
+
@source_type = payload["source_type"]
|
|
63
|
+
@intelligence_operator = payload["intelligence_operator"]
|
|
64
|
+
end
|
|
65
|
+
def to_json(options = {})
|
|
66
|
+
{
|
|
67
|
+
"sourceType": @source_type,
|
|
68
|
+
"intelligenceOperator": @intelligence_operator,
|
|
69
|
+
}.to_json(options)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
class IntelligenceOperatorSource
|
|
74
|
+
# @param [operator_id]: [String] The ID of the Conversational Intelligence operator whose output supplies this field's value. Must match `^intelligence_operator_[0-7][0-9a-z]{25}$`. Cannot be changed after registration.
|
|
75
|
+
# @param [operator_name]: [String] Optional, display-only name of the operator. Stored as supplied and not validated against the operator.
|
|
76
|
+
# @param [field]: [String] Path to the property in the operator's output schema that supplies this field's value. Rules: - one or two segments separated by `.` — a top-level property (`leadScore`) or one level of nesting (`scores.leadScore`); - each segment contains only letters, digits and `_`; array indexing (such as `items[0]`) is not supported; - the path must exist in the output schema of the operator's latest active version and resolve to a property of type `number` or `integer`.
|
|
77
|
+
attr_accessor :operator_id, :operator_name, :field
|
|
78
|
+
def initialize(payload)
|
|
79
|
+
@operator_id = payload["operator_id"]
|
|
80
|
+
@operator_name = payload["operator_name"]
|
|
81
|
+
@field = payload["field"]
|
|
82
|
+
end
|
|
83
|
+
def to_json(options = {})
|
|
84
|
+
{
|
|
85
|
+
"operatorId": @operator_id,
|
|
86
|
+
"operatorName": @operator_name,
|
|
87
|
+
"field": @field,
|
|
88
|
+
}.to_json(options)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
class IntelligenceOperatorSourceUpdate
|
|
93
|
+
# @param [field]: [String] New path to the property in the operator's output schema. Follows the same rules as `field` at registration: one or two `.`-separated segments of letters, digits and `_`, resolving to a `number` or `integer` property on the operator's latest active version.
|
|
94
|
+
attr_accessor :field
|
|
95
|
+
def initialize(payload)
|
|
96
|
+
@field = payload["field"]
|
|
97
|
+
end
|
|
98
|
+
def to_json(options = {})
|
|
99
|
+
{
|
|
100
|
+
"field": @field,
|
|
101
|
+
}.to_json(options)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class CustomFieldMappingRequest
|
|
107
|
+
# @param [category]: [MappingCategory]
|
|
108
|
+
# @param [name]: [String] Name of the custom field, used to reference it in Insights queries. Contains only letters, digits and `_`, and must not be empty. Must be unique within the account across every `sourceType`; registering an existing name returns `409`. Cannot be changed after registration.
|
|
109
|
+
# @param [description]: [String] Optional, free-text description of this custom field mapping, up to 150 characters. Display-only — not part of any uniqueness check.
|
|
110
|
+
# @param [entity_metadata]: [CustomFieldMappingList.EntityMetadata]
|
|
111
|
+
attr_accessor :category, :name, :description, :entity_metadata
|
|
112
|
+
def initialize(payload)
|
|
113
|
+
@category = payload["category"]
|
|
114
|
+
@name = payload["name"]
|
|
115
|
+
@description = payload["description"]
|
|
116
|
+
@entity_metadata = payload["entity_metadata"]
|
|
117
|
+
end
|
|
118
|
+
def to_json(options = {})
|
|
119
|
+
{
|
|
120
|
+
"category": @category,
|
|
121
|
+
"name": @name,
|
|
122
|
+
"description": @description,
|
|
123
|
+
"entityMetadata": @entity_metadata,
|
|
124
|
+
}.to_json(options)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
class CustomFieldMappingUpdateRequest
|
|
129
|
+
# @param [entity_metadata]: [CustomFieldMappingList.EntityMetadataUpdate]
|
|
130
|
+
attr_accessor :entity_metadata
|
|
131
|
+
def initialize(payload)
|
|
132
|
+
@entity_metadata = payload["entity_metadata"]
|
|
133
|
+
end
|
|
134
|
+
def to_json(options = {})
|
|
135
|
+
{
|
|
136
|
+
"entityMetadata": @entity_metadata,
|
|
137
|
+
}.to_json(options)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
class EntityMetadataUpdate
|
|
142
|
+
# @param [source_type]: [SourceType]
|
|
143
|
+
# @param [intelligence_operator]: [CustomFieldMappingList.IntelligenceOperatorSourceUpdate]
|
|
144
|
+
attr_accessor :source_type, :intelligence_operator
|
|
145
|
+
def initialize(payload)
|
|
146
|
+
@source_type = payload["source_type"]
|
|
147
|
+
@intelligence_operator = payload["intelligence_operator"]
|
|
148
|
+
end
|
|
149
|
+
def to_json(options = {})
|
|
150
|
+
{
|
|
151
|
+
"sourceType": @source_type,
|
|
152
|
+
"intelligenceOperator": @intelligence_operator,
|
|
153
|
+
}.to_json(options)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
class IntelligenceOperatorSource
|
|
158
|
+
# @param [operator_id]: [String] The ID of the Conversational Intelligence operator whose output supplies this field's value. Must match `^intelligence_operator_[0-7][0-9a-z]{25}$`. Cannot be changed after registration.
|
|
159
|
+
# @param [operator_name]: [String] Optional, display-only name of the operator. Stored as supplied and not validated against the operator.
|
|
160
|
+
# @param [field]: [String] Path to the property in the operator's output schema that supplies this field's value. Rules: - one or two segments separated by `.` — a top-level property (`leadScore`) or one level of nesting (`scores.leadScore`); - each segment contains only letters, digits and `_`; array indexing (such as `items[0]`) is not supported; - the path must exist in the output schema of the operator's latest active version and resolve to a property of type `number` or `integer`.
|
|
161
|
+
attr_accessor :operator_id, :operator_name, :field
|
|
162
|
+
def initialize(payload)
|
|
163
|
+
@operator_id = payload["operator_id"]
|
|
164
|
+
@operator_name = payload["operator_name"]
|
|
165
|
+
@field = payload["field"]
|
|
166
|
+
end
|
|
167
|
+
def to_json(options = {})
|
|
168
|
+
{
|
|
169
|
+
"operatorId": @operator_id,
|
|
170
|
+
"operatorName": @operator_name,
|
|
171
|
+
"field": @field,
|
|
172
|
+
}.to_json(options)
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class IntelligenceOperatorSourceUpdate
|
|
177
|
+
# @param [field]: [String] New path to the property in the operator's output schema. Follows the same rules as `field` at registration: one or two `.`-separated segments of letters, digits and `_`, resolving to a `number` or `integer` property on the operator's latest active version.
|
|
178
|
+
attr_accessor :field
|
|
179
|
+
def initialize(payload)
|
|
180
|
+
@field = payload["field"]
|
|
181
|
+
end
|
|
182
|
+
def to_json(options = {})
|
|
183
|
+
{
|
|
184
|
+
"field": @field,
|
|
185
|
+
}.to_json(options)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
##
|
|
191
|
+
# Initialize the CustomFieldMappingList
|
|
192
|
+
# @param [Version] version Version that contains the resource
|
|
193
|
+
# @return [CustomFieldMappingList] CustomFieldMappingList
|
|
194
|
+
def initialize(version)
|
|
195
|
+
|
|
196
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
197
|
+
super(apiV1Version)
|
|
198
|
+
# Path Solution
|
|
199
|
+
@solution = { }
|
|
200
|
+
@uri = "/ControlPlane/ConversationInsights/CustomFieldMappings"
|
|
201
|
+
|
|
202
|
+
end
|
|
203
|
+
##
|
|
204
|
+
# Create the CustomFieldMappingInstance
|
|
205
|
+
# @param [CustomFieldMappingRequest] custom_field_mapping_request
|
|
206
|
+
# @return [CustomFieldMappingInstance] Created CustomFieldMappingInstance
|
|
207
|
+
def create(custom_field_mapping_request: nil
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
211
|
+
headers['Content-Type'] = 'application/json'
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
payload = @version.create('POST', @uri, headers: headers, data: custom_field_mapping_request.to_json)
|
|
217
|
+
CustomFieldMappingInstance.new(
|
|
218
|
+
@version,
|
|
219
|
+
payload,
|
|
220
|
+
)
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
##
|
|
224
|
+
# Create the CustomFieldMappingInstanceMetadata
|
|
225
|
+
# @param [CustomFieldMappingRequest] custom_field_mapping_request
|
|
226
|
+
# @return [CustomFieldMappingInstance] Created CustomFieldMappingInstance
|
|
227
|
+
def create_with_metadata(custom_field_mapping_request: nil
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
231
|
+
headers['Content-Type'] = 'application/json'
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: custom_field_mapping_request.to_json)
|
|
237
|
+
custom_field_mapping_instance = CustomFieldMappingInstance.new(
|
|
238
|
+
@version,
|
|
239
|
+
response.body,
|
|
240
|
+
)
|
|
241
|
+
CustomFieldMappingInstanceMetadata.new(
|
|
242
|
+
@version,
|
|
243
|
+
custom_field_mapping_instance,
|
|
244
|
+
response.headers,
|
|
245
|
+
response.status_code
|
|
246
|
+
)
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
##
|
|
251
|
+
# Lists CustomFieldMappingInstance records from the API as a list.
|
|
252
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
253
|
+
# memory before returning.
|
|
254
|
+
# @param [String] page_token Token for pagination
|
|
255
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
256
|
+
# guarantees to never return more than limit. Default is no limit
|
|
257
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
258
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
259
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
260
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
261
|
+
# @return [Array] Array of up to limit results
|
|
262
|
+
def list(page_token: :unset, limit: nil, page_size: nil)
|
|
263
|
+
self.stream(
|
|
264
|
+
page_token: page_token,
|
|
265
|
+
limit: limit,
|
|
266
|
+
page_size: page_size
|
|
267
|
+
).entries
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
##
|
|
271
|
+
# Streams Instance records from the API as an Enumerable.
|
|
272
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
273
|
+
# is reached.
|
|
274
|
+
# @param [String] page_token Token for pagination
|
|
275
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
276
|
+
# guarantees to never return more than limit. Default is no limit
|
|
277
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
278
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
279
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
280
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
281
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
282
|
+
def stream(page_token: :unset, limit: nil, page_size: nil)
|
|
283
|
+
limits = @version.read_limits(limit, page_size)
|
|
284
|
+
|
|
285
|
+
page = self.page(
|
|
286
|
+
page_token: page_token,
|
|
287
|
+
page_size: limits[:page_size], )
|
|
288
|
+
|
|
289
|
+
return [].each if page.nil?
|
|
290
|
+
|
|
291
|
+
result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
292
|
+
return [].each if result.nil?
|
|
293
|
+
result
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
##
|
|
297
|
+
# Lists CustomFieldMappingPageMetadata records from the API as a list.
|
|
298
|
+
# @param [String] page_token Token for pagination
|
|
299
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
300
|
+
# guarantees to never return more than limit. Default is no limit
|
|
301
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
302
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
303
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
304
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
305
|
+
# @return [Array] Array of up to limit results
|
|
306
|
+
def list_with_metadata(page_token: :unset, limit: nil, page_size: nil)
|
|
307
|
+
limits = @version.read_limits(limit, page_size)
|
|
308
|
+
params = Twilio::Values.of({
|
|
309
|
+
'pageToken' => page_token,
|
|
310
|
+
|
|
311
|
+
'PageSize' => limits[:page_size],
|
|
312
|
+
});
|
|
313
|
+
headers = Twilio::Values.of({})
|
|
314
|
+
|
|
315
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
316
|
+
|
|
317
|
+
CustomFieldMappingPageMetadata.new(@version, response, @solution, limits[:limit])
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
##
|
|
321
|
+
# When passed a block, yields CustomFieldMappingInstance records from the API.
|
|
322
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
323
|
+
# is reached.
|
|
324
|
+
def each
|
|
325
|
+
limits = @version.read_limits
|
|
326
|
+
|
|
327
|
+
page = self.page(page_size: limits[:page_size], )
|
|
328
|
+
|
|
329
|
+
return [].each if page.nil?
|
|
330
|
+
|
|
331
|
+
result = @version.stream(page,
|
|
332
|
+
limit: limits[:limit],
|
|
333
|
+
page_limit: limits[:page_limit])
|
|
334
|
+
return [].each if result.nil?
|
|
335
|
+
result.each {|x| yield x}
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
##
|
|
339
|
+
# Retrieve a single page of CustomFieldMappingInstance records from the API.
|
|
340
|
+
# Request is executed immediately.
|
|
341
|
+
# @param [String] page_token Token for pagination
|
|
342
|
+
|
|
343
|
+
# @return [Page] Page of CustomFieldMappingInstance
|
|
344
|
+
def page(page_token: :unset, page_size: :unset)
|
|
345
|
+
params = Twilio::Values.of({
|
|
346
|
+
'pageToken' => page_token,
|
|
347
|
+
'PageSize' => page_size,
|
|
348
|
+
})
|
|
349
|
+
headers = Twilio::Values.of({})
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
354
|
+
|
|
355
|
+
CustomFieldMappingPage.new(@version, response, @solution)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
##
|
|
359
|
+
# Retrieve a single page of CustomFieldMappingInstance records from the API.
|
|
360
|
+
# Request is executed immediately.
|
|
361
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
362
|
+
# @return [Page] Page of CustomFieldMappingInstance
|
|
363
|
+
def get_page(target_url)
|
|
364
|
+
response = @version.domain.request(
|
|
365
|
+
'GET',
|
|
366
|
+
target_url
|
|
367
|
+
)
|
|
368
|
+
CustomFieldMappingPage.new(@version, response, @solution)
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
# Provide a user friendly representation
|
|
374
|
+
def to_s
|
|
375
|
+
'#<Twilio.Insights.V3.CustomFieldMappingList>'
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
class CustomFieldMappingContext < InstanceContext
|
|
381
|
+
##
|
|
382
|
+
# Initialize the CustomFieldMappingContext
|
|
383
|
+
# @param [Version] version Version that contains the resource
|
|
384
|
+
# @param [String] mapping_id The unique identifier of the custom field mapping, as returned in `id` when the mapping was created.
|
|
385
|
+
# @return [CustomFieldMappingContext] CustomFieldMappingContext
|
|
386
|
+
def initialize(version, mapping_id)
|
|
387
|
+
|
|
388
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
389
|
+
super(apiV1Version)
|
|
390
|
+
|
|
391
|
+
# Path Solution
|
|
392
|
+
@solution = { mapping_id: mapping_id, }
|
|
393
|
+
@uri = "/ControlPlane/ConversationInsights/CustomFieldMappings/#{@solution[:mapping_id]}"
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
end
|
|
397
|
+
##
|
|
398
|
+
# Fetch the CustomFieldMappingInstance
|
|
399
|
+
# @return [CustomFieldMappingInstance] Fetched CustomFieldMappingInstance
|
|
400
|
+
def fetch
|
|
401
|
+
|
|
402
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
payload = @version.fetch('GET', @uri, headers: headers)
|
|
409
|
+
CustomFieldMappingInstance.new(
|
|
410
|
+
@version,
|
|
411
|
+
payload,
|
|
412
|
+
mapping_id: @solution[:mapping_id],
|
|
413
|
+
)
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
##
|
|
417
|
+
# Fetch the CustomFieldMappingInstanceMetadata
|
|
418
|
+
# @return [CustomFieldMappingInstance] Fetched CustomFieldMappingInstance
|
|
419
|
+
def fetch_with_metadata
|
|
420
|
+
|
|
421
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
response = @version.fetch_with_metadata('GET', @uri, headers: headers)
|
|
428
|
+
custom_field_mapping_instance = CustomFieldMappingInstance.new(
|
|
429
|
+
@version,
|
|
430
|
+
response.body,
|
|
431
|
+
mapping_id: @solution[:mapping_id],
|
|
432
|
+
)
|
|
433
|
+
CustomFieldMappingInstanceMetadata.new(
|
|
434
|
+
@version,
|
|
435
|
+
custom_field_mapping_instance,
|
|
436
|
+
response.headers,
|
|
437
|
+
response.status_code
|
|
438
|
+
)
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
##
|
|
442
|
+
# Patch the CustomFieldMappingInstance
|
|
443
|
+
# @param [String] if_match ETag of the custom field mapping, as returned in the `ETag` response header. When supplied, the update is applied only if the mapping has not changed since that ETag was issued; otherwise `412` is returned.
|
|
444
|
+
# @param [CustomFieldMappingUpdateRequest] custom_field_mapping_update_request
|
|
445
|
+
# @return [CustomFieldMappingInstance] Patched CustomFieldMappingInstance
|
|
446
|
+
def patch(
|
|
447
|
+
if_match: :unset,
|
|
448
|
+
custom_field_mapping_update_request: nil
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, })
|
|
452
|
+
headers['Content-Type'] = 'application/json'
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
payload = @version.patch('PATCH', @uri, headers: headers, data: custom_field_mapping_update_request.to_json)
|
|
458
|
+
CustomFieldMappingInstance.new(
|
|
459
|
+
@version,
|
|
460
|
+
payload,
|
|
461
|
+
mapping_id: @solution[:mapping_id],
|
|
462
|
+
)
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
##
|
|
466
|
+
# Patch the CustomFieldMappingInstanceMetadata
|
|
467
|
+
# @param [String] if_match ETag of the custom field mapping, as returned in the `ETag` response header. When supplied, the update is applied only if the mapping has not changed since that ETag was issued; otherwise `412` is returned.
|
|
468
|
+
# @param [CustomFieldMappingUpdateRequest] custom_field_mapping_update_request
|
|
469
|
+
# @return [CustomFieldMappingInstance] Patchd CustomFieldMappingInstance
|
|
470
|
+
def patch_with_metadata(
|
|
471
|
+
if_match: :unset,
|
|
472
|
+
custom_field_mapping_update_request: nil
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, })
|
|
476
|
+
headers['Content-Type'] = 'application/json'
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
response = @version.patch_with_metadata('PATCH', @uri, headers: headers, data: custom_field_mapping_update_request.to_json)
|
|
482
|
+
custom_field_mapping_instance = CustomFieldMappingInstance.new(
|
|
483
|
+
@version,
|
|
484
|
+
response.body,
|
|
485
|
+
mapping_id: @solution[:mapping_id],
|
|
486
|
+
)
|
|
487
|
+
CustomFieldMappingInstanceMetadata.new(
|
|
488
|
+
@version,
|
|
489
|
+
custom_field_mapping_instance,
|
|
490
|
+
response.headers,
|
|
491
|
+
response.status_code
|
|
492
|
+
)
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
##
|
|
497
|
+
# Provide a user friendly representation
|
|
498
|
+
def to_s
|
|
499
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
500
|
+
"#<Twilio.Insights.V3.CustomFieldMappingContext #{context}>"
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
##
|
|
504
|
+
# Provide a detailed, user friendly representation
|
|
505
|
+
def inspect
|
|
506
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
507
|
+
"#<Twilio.Insights.V3.CustomFieldMappingContext #{context}>"
|
|
508
|
+
end
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
class CustomFieldMappingInstanceMetadata < InstanceResourceMetadata
|
|
512
|
+
##
|
|
513
|
+
# Initializes a new CustomFieldMappingInstanceMetadata.
|
|
514
|
+
# @param [Version] version Version that contains the resource
|
|
515
|
+
# @param [}CustomFieldMappingInstance] custom_field_mapping_instance The instance associated with the metadata.
|
|
516
|
+
# @param [Hash] headers Header object with response headers.
|
|
517
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
518
|
+
# @return [CustomFieldMappingInstanceMetadata] The initialized instance with metadata.
|
|
519
|
+
def initialize(version, custom_field_mapping_instance, headers, status_code)
|
|
520
|
+
super(version, headers, status_code)
|
|
521
|
+
@custom_field_mapping_instance = custom_field_mapping_instance
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
def custom_field_mapping
|
|
525
|
+
@custom_field_mapping_instance
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
def headers
|
|
529
|
+
@headers
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
def status_code
|
|
533
|
+
@status_code
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
def to_s
|
|
537
|
+
"<Twilio.Api.V2010.CustomFieldMappingInstanceMetadata status=#{@status_code}>"
|
|
538
|
+
end
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
class CustomFieldMappingListResponse < InstanceListResource
|
|
542
|
+
# @param [Array<CustomFieldMappingInstance>] instance
|
|
543
|
+
# @param [Hash{String => Object}] headers
|
|
544
|
+
# @param [Integer] status_code
|
|
545
|
+
def initialize(version, payload, key)
|
|
546
|
+
@custom_field_mapping_instance = payload.body[key].map do |data|
|
|
547
|
+
CustomFieldMappingInstance.new(version, data)
|
|
548
|
+
end
|
|
549
|
+
@headers = payload.headers
|
|
550
|
+
@status_code = payload.status_code
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
def custom_field_mapping_instance
|
|
554
|
+
@instance
|
|
555
|
+
end
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
class CustomFieldMappingPage < TokenPage
|
|
559
|
+
##
|
|
560
|
+
# Initialize the CustomFieldMappingPage
|
|
561
|
+
# @param [Version] version Version that contains the resource
|
|
562
|
+
# @param [Response] response Response from the API
|
|
563
|
+
# @param [Hash] solution Path solution for the resource
|
|
564
|
+
# @return [CustomFieldMappingPage] CustomFieldMappingPage
|
|
565
|
+
def initialize(version, response, solution)
|
|
566
|
+
|
|
567
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
568
|
+
super(apiV1Version, response)
|
|
569
|
+
|
|
570
|
+
# Path Solution
|
|
571
|
+
@solution = solution
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
##
|
|
575
|
+
# Build an instance of CustomFieldMappingInstance
|
|
576
|
+
# @param [Hash] payload Payload response from the API
|
|
577
|
+
# @return [CustomFieldMappingInstance] CustomFieldMappingInstance
|
|
578
|
+
def get_instance(payload)
|
|
579
|
+
CustomFieldMappingInstance.new(@version, payload)
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
##
|
|
583
|
+
# Provide a user friendly representation
|
|
584
|
+
def to_s
|
|
585
|
+
'<Twilio.Insights.V3.CustomFieldMappingPage>'
|
|
586
|
+
end
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
class CustomFieldMappingPageMetadata < PageMetadata
|
|
590
|
+
attr_reader :custom_field_mapping_page
|
|
591
|
+
|
|
592
|
+
def initialize(version, response, solution, limit)
|
|
593
|
+
super(version, response)
|
|
594
|
+
@custom_field_mapping_page = []
|
|
595
|
+
@limit = limit
|
|
596
|
+
key = get_key(response.body)
|
|
597
|
+
records = 0
|
|
598
|
+
while( limit != :unset && records < limit )
|
|
599
|
+
@custom_field_mapping_page << CustomFieldMappingListResponse.new(version, @payload, key, limit - records)
|
|
600
|
+
@payload = self.next_page
|
|
601
|
+
break unless @payload
|
|
602
|
+
records += (@payload.body[key] || []).size
|
|
603
|
+
end
|
|
604
|
+
# Path Solution
|
|
605
|
+
@solution = solution
|
|
606
|
+
end
|
|
607
|
+
|
|
608
|
+
def each
|
|
609
|
+
@custom_field_mapping_page.each do |record|
|
|
610
|
+
yield record
|
|
611
|
+
end
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
def to_s
|
|
615
|
+
'<Twilio::REST::Insights::V3PageMetadata>';
|
|
616
|
+
end
|
|
617
|
+
end
|
|
618
|
+
class CustomFieldMappingListResponse < InstanceListResource
|
|
619
|
+
|
|
620
|
+
# @param [Array<CustomFieldMappingInstance>] instance
|
|
621
|
+
# @param [Hash{String => Object}] headers
|
|
622
|
+
# @param [Integer] status_code
|
|
623
|
+
def initialize(version, payload, key, limit = :unset)
|
|
624
|
+
data_list = payload.body[key] || []
|
|
625
|
+
if limit != :unset
|
|
626
|
+
data_list = data_list[0, limit]
|
|
627
|
+
end
|
|
628
|
+
@custom_field_mapping = data_list.map do |data|
|
|
629
|
+
CustomFieldMappingInstance.new(version, data)
|
|
630
|
+
end
|
|
631
|
+
@headers = payload.headers
|
|
632
|
+
@status_code = payload.status_code
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
def custom_field_mapping
|
|
636
|
+
@custom_field_mapping
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
def headers
|
|
640
|
+
@headers
|
|
641
|
+
end
|
|
642
|
+
|
|
643
|
+
def status_code
|
|
644
|
+
@status_code
|
|
645
|
+
end
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
class CustomFieldMappingInstance < InstanceResource
|
|
649
|
+
##
|
|
650
|
+
# Initialize the CustomFieldMappingInstance
|
|
651
|
+
# @param [Version] version Version that contains the resource
|
|
652
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
653
|
+
# @param [String] account_sid The SID of the
|
|
654
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this CustomFieldMapping
|
|
655
|
+
# resource.
|
|
656
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
657
|
+
# @return [CustomFieldMappingInstance] CustomFieldMappingInstance
|
|
658
|
+
def initialize(version, payload , mapping_id: nil)
|
|
659
|
+
|
|
660
|
+
apiV1Version = ApiV1Version.new version.domain, version
|
|
661
|
+
super(apiV1Version)
|
|
662
|
+
|
|
663
|
+
# Marshaled Properties
|
|
664
|
+
@properties = {
|
|
665
|
+
'id' => payload['id'],
|
|
666
|
+
'category' => payload['category'],
|
|
667
|
+
'name' => payload['name'],
|
|
668
|
+
'description' => payload['description'],
|
|
669
|
+
'entity_metadata' => payload['entity_metadata'],
|
|
670
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
|
671
|
+
'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
# Context
|
|
675
|
+
@instance_context = nil
|
|
676
|
+
@params = { 'mapping_id' => mapping_id || @properties['mapping_id'] , }
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
##
|
|
680
|
+
# Generate an instance context for the instance, the context is capable of
|
|
681
|
+
# performing various actions. All instance actions are proxied to the context
|
|
682
|
+
# @return [CustomFieldMappingContext] CallContext for this CallInstance
|
|
683
|
+
def context
|
|
684
|
+
unless @instance_context
|
|
685
|
+
@instance_context = CustomFieldMappingContext.new(@version , @params['mapping_id'])
|
|
686
|
+
end
|
|
687
|
+
@instance_context
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
##
|
|
691
|
+
# @return [String] The unique identifier of the custom field mapping.
|
|
692
|
+
def id
|
|
693
|
+
@properties['id']
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
##
|
|
697
|
+
# @return [MappingCategory]
|
|
698
|
+
def category
|
|
699
|
+
@properties['category']
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
##
|
|
703
|
+
# @return [String] Name of the custom field, unique within the account.
|
|
704
|
+
def name
|
|
705
|
+
@properties['name']
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
##
|
|
709
|
+
# @return [String] Optional, free-text description supplied at registration time. Display-only — not part of any uniqueness check.
|
|
710
|
+
def description
|
|
711
|
+
@properties['description']
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
##
|
|
715
|
+
# @return [EntityMetadata]
|
|
716
|
+
def entity_metadata
|
|
717
|
+
@properties['entity_metadata']
|
|
718
|
+
end
|
|
719
|
+
|
|
720
|
+
##
|
|
721
|
+
# @return [Time] When the mapping was registered.
|
|
722
|
+
def created_at
|
|
723
|
+
@properties['created_at']
|
|
724
|
+
end
|
|
725
|
+
|
|
726
|
+
##
|
|
727
|
+
# @return [Time] When the mapping was last modified via `PATCH`. Null until the first update.
|
|
728
|
+
def updated_at
|
|
729
|
+
@properties['updated_at']
|
|
730
|
+
end
|
|
731
|
+
|
|
732
|
+
##
|
|
733
|
+
# Fetch the CustomFieldMappingInstance
|
|
734
|
+
# @return [CustomFieldMappingInstance] Fetched CustomFieldMappingInstance
|
|
735
|
+
def fetch
|
|
736
|
+
|
|
737
|
+
context.fetch
|
|
738
|
+
end
|
|
739
|
+
|
|
740
|
+
##
|
|
741
|
+
# Patch the CustomFieldMappingInstance
|
|
742
|
+
# @param [String] if_match ETag of the custom field mapping, as returned in the `ETag` response header. When supplied, the update is applied only if the mapping has not changed since that ETag was issued; otherwise `412` is returned.
|
|
743
|
+
# @param [CustomFieldMappingUpdateRequest] custom_field_mapping_update_request
|
|
744
|
+
# @return [CustomFieldMappingInstance] Patched CustomFieldMappingInstance
|
|
745
|
+
def patch(
|
|
746
|
+
if_match: :unset,
|
|
747
|
+
custom_field_mapping_update_request: nil
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
context.patch(
|
|
751
|
+
if_match: if_match,
|
|
752
|
+
custom_field_mapping_update_request: custom_field_mapping_update_request,
|
|
753
|
+
)
|
|
754
|
+
end
|
|
755
|
+
|
|
756
|
+
##
|
|
757
|
+
# Provide a user friendly representation
|
|
758
|
+
def to_s
|
|
759
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
760
|
+
"<Twilio.Insights.V3.CustomFieldMappingInstance #{values}>"
|
|
761
|
+
end
|
|
762
|
+
|
|
763
|
+
##
|
|
764
|
+
# Provide a detailed, user friendly representation
|
|
765
|
+
def inspect
|
|
766
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
767
|
+
"<Twilio.Insights.V3.CustomFieldMappingInstance #{values}>"
|
|
768
|
+
end
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
end
|
|
774
|
+
end
|