twilio-ruby 7.11.3 → 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/CHANGES.md +76 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +4 -4
- 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 +35 -3
- 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/conversation_summary.rb +5 -5
- 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/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/version.rb +1 -1
- metadata +4 -4
- data/lib/twilio-ruby/rest/numbers/v1/voice_verification_check.rb +0 -165
|
@@ -21,9 +21,9 @@ module Twilio
|
|
|
21
21
|
|
|
22
22
|
class CustomFieldMappingRequest
|
|
23
23
|
# @param [category]: [MappingCategory]
|
|
24
|
-
# @param [name]: [String]
|
|
25
|
-
# @param [description]: [String] Optional, free-text description of this custom field mapping. Display-only — not part of any uniqueness check.
|
|
26
|
-
# @param [entity_metadata]: [CustomFieldMappingList.
|
|
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
27
|
attr_accessor :category, :name, :description, :entity_metadata
|
|
28
28
|
def initialize(payload)
|
|
29
29
|
@category = payload["category"]
|
|
@@ -41,6 +41,151 @@ module Twilio
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
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
|
+
|
|
44
189
|
|
|
45
190
|
##
|
|
46
191
|
# Initialize the CustomFieldMappingList
|
|
@@ -101,6 +246,154 @@ module Twilio
|
|
|
101
246
|
)
|
|
102
247
|
end
|
|
103
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
|
|
104
397
|
##
|
|
105
398
|
# Fetch the CustomFieldMappingInstance
|
|
106
399
|
# @return [CustomFieldMappingInstance] Fetched CustomFieldMappingInstance
|
|
@@ -116,6 +409,7 @@ module Twilio
|
|
|
116
409
|
CustomFieldMappingInstance.new(
|
|
117
410
|
@version,
|
|
118
411
|
payload,
|
|
412
|
+
mapping_id: @solution[:mapping_id],
|
|
119
413
|
)
|
|
120
414
|
end
|
|
121
415
|
|
|
@@ -134,6 +428,7 @@ module Twilio
|
|
|
134
428
|
custom_field_mapping_instance = CustomFieldMappingInstance.new(
|
|
135
429
|
@version,
|
|
136
430
|
response.body,
|
|
431
|
+
mapping_id: @solution[:mapping_id],
|
|
137
432
|
)
|
|
138
433
|
CustomFieldMappingInstanceMetadata.new(
|
|
139
434
|
@version,
|
|
@@ -143,15 +438,123 @@ module Twilio
|
|
|
143
438
|
)
|
|
144
439
|
end
|
|
145
440
|
|
|
146
|
-
|
|
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
|
+
)
|
|
147
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
|
+
)
|
|
148
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
|
+
##
|
|
149
497
|
# Provide a user friendly representation
|
|
150
498
|
def to_s
|
|
151
|
-
|
|
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}>"
|
|
152
538
|
end
|
|
153
539
|
end
|
|
154
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
|
+
|
|
155
558
|
class CustomFieldMappingPage < TokenPage
|
|
156
559
|
##
|
|
157
560
|
# Initialize the CustomFieldMappingPage
|
|
@@ -183,6 +586,65 @@ module Twilio
|
|
|
183
586
|
end
|
|
184
587
|
end
|
|
185
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
|
+
|
|
186
648
|
class CustomFieldMappingInstance < InstanceResource
|
|
187
649
|
##
|
|
188
650
|
# Initialize the CustomFieldMappingInstance
|
|
@@ -193,7 +655,7 @@ module Twilio
|
|
|
193
655
|
# resource.
|
|
194
656
|
# @param [String] sid The SID of the Call resource to fetch.
|
|
195
657
|
# @return [CustomFieldMappingInstance] CustomFieldMappingInstance
|
|
196
|
-
def initialize(version, payload )
|
|
658
|
+
def initialize(version, payload , mapping_id: nil)
|
|
197
659
|
|
|
198
660
|
apiV1Version = ApiV1Version.new version.domain, version
|
|
199
661
|
super(apiV1Version)
|
|
@@ -207,13 +669,26 @@ module Twilio
|
|
|
207
669
|
'entity_metadata' => payload['entity_metadata'],
|
|
208
670
|
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
|
209
671
|
'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
|
|
210
|
-
'mappings' => payload['mappings'],
|
|
211
672
|
}
|
|
673
|
+
|
|
674
|
+
# Context
|
|
675
|
+
@instance_context = nil
|
|
676
|
+
@params = { 'mapping_id' => mapping_id || @properties['mapping_id'] , }
|
|
212
677
|
end
|
|
213
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
|
|
214
689
|
|
|
215
690
|
##
|
|
216
|
-
# @return [String]
|
|
691
|
+
# @return [String] The unique identifier of the custom field mapping.
|
|
217
692
|
def id
|
|
218
693
|
@properties['id']
|
|
219
694
|
end
|
|
@@ -225,7 +700,7 @@ module Twilio
|
|
|
225
700
|
end
|
|
226
701
|
|
|
227
702
|
##
|
|
228
|
-
# @return [String]
|
|
703
|
+
# @return [String] Name of the custom field, unique within the account.
|
|
229
704
|
def name
|
|
230
705
|
@properties['name']
|
|
231
706
|
end
|
|
@@ -237,7 +712,7 @@ module Twilio
|
|
|
237
712
|
end
|
|
238
713
|
|
|
239
714
|
##
|
|
240
|
-
# @return [
|
|
715
|
+
# @return [EntityMetadata]
|
|
241
716
|
def entity_metadata
|
|
242
717
|
@properties['entity_metadata']
|
|
243
718
|
end
|
|
@@ -249,27 +724,47 @@ module Twilio
|
|
|
249
724
|
end
|
|
250
725
|
|
|
251
726
|
##
|
|
252
|
-
# @return [Time] When the mapping was last
|
|
727
|
+
# @return [Time] When the mapping was last modified via `PATCH`. Null until the first update.
|
|
253
728
|
def updated_at
|
|
254
729
|
@properties['updated_at']
|
|
255
730
|
end
|
|
256
731
|
|
|
257
732
|
##
|
|
258
|
-
#
|
|
259
|
-
|
|
260
|
-
|
|
733
|
+
# Fetch the CustomFieldMappingInstance
|
|
734
|
+
# @return [CustomFieldMappingInstance] Fetched CustomFieldMappingInstance
|
|
735
|
+
def fetch
|
|
736
|
+
|
|
737
|
+
context.fetch
|
|
261
738
|
end
|
|
262
|
-
|
|
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
|
+
|
|
263
756
|
##
|
|
264
757
|
# Provide a user friendly representation
|
|
265
758
|
def to_s
|
|
266
|
-
"
|
|
759
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
760
|
+
"<Twilio.Insights.V3.CustomFieldMappingInstance #{values}>"
|
|
267
761
|
end
|
|
268
762
|
|
|
269
763
|
##
|
|
270
764
|
# Provide a detailed, user friendly representation
|
|
271
765
|
def inspect
|
|
272
|
-
"
|
|
766
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
767
|
+
"<Twilio.Insights.V3.CustomFieldMappingInstance #{values}>"
|
|
273
768
|
end
|
|
274
769
|
end
|
|
275
770
|
|