twilio-ruby 7.10.3 → 7.10.4
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 +34 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/flex_api_base.rb +1 -6
- data/lib/twilio-ruby/rest/insights/v2/inbound.rb +570 -0
- data/lib/twilio-ruby/rest/insights/v2/outbound.rb +641 -0
- data/lib/twilio-ruby/rest/insights/v2/report.rb +940 -0
- data/lib/twilio-ruby/rest/insights/v2.rb +79 -0
- data/lib/twilio-ruby/rest/insights_base.rb +6 -1
- data/lib/twilio-ruby/rest/numbers/v1/embedded_session.rb +251 -0
- data/lib/twilio-ruby/rest/numbers/v1/sender_id_registration.rb +333 -0
- data/lib/twilio-ruby/rest/numbers/v1.rb +12 -0
- data/lib/twilio-ruby/rest/numbers/v2/application.rb +153 -8
- data/lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb +197 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/execution.rb +14 -0
- data/lib/twilio-ruby/rest/studio/v2/flow/flow_revision.rb +7 -0
- data/lib/twilio-ruby/rest/studio/v2/flow.rb +7 -0
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +2 -2
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +8 -2
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
|
4
|
+
# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
|
5
|
+
# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
|
6
|
+
#
|
|
7
|
+
# Sample/reference Twilio API.
|
|
8
|
+
# This is the reference API for the rest-proxy server.
|
|
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 V2 < Version
|
|
20
|
+
class OutboundList < ListResource
|
|
21
|
+
|
|
22
|
+
class CountyCarrierValueCarriers
|
|
23
|
+
# @param [carrier]: [String] The name of the carrier.
|
|
24
|
+
# @param [total_calls]: [Integer] Total number of outbound calls for the carrier in the country.
|
|
25
|
+
# @param [blocked_calls]: [Integer] Total number of blocked outbound calls for the carrier in the country.
|
|
26
|
+
# @param [blocked_calls_percentage]: [Float] Percentage of blocked outbound calls for the carrier in the country.
|
|
27
|
+
attr_accessor :carrier, :total_calls, :blocked_calls, :blocked_calls_percentage
|
|
28
|
+
def initialize(payload)
|
|
29
|
+
@carrier = payload["carrier"]
|
|
30
|
+
@total_calls = payload["total_calls"]
|
|
31
|
+
@blocked_calls = payload["blocked_calls"]
|
|
32
|
+
@blocked_calls_percentage = payload["blocked_calls_percentage"]
|
|
33
|
+
end
|
|
34
|
+
def to_json(options = {})
|
|
35
|
+
{
|
|
36
|
+
"carrier": @carrier,
|
|
37
|
+
"total_calls": @total_calls,
|
|
38
|
+
"blocked_calls": @blocked_calls,
|
|
39
|
+
"blocked_calls_percentage": @blocked_calls_percentage,
|
|
40
|
+
}.to_json(options)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class InsightsV2CreatePhoneNumbersReportRequest
|
|
45
|
+
# @param [time_range]: [InboundList.InsightsV2CreatePhoneNumbersReportRequestTimeRange]
|
|
46
|
+
# @param [filters]: [Array<InboundList.PhoneNumberReportFilter>]
|
|
47
|
+
# @param [size]: [String] The number of max available top Phone Numbers to generate.
|
|
48
|
+
attr_accessor :time_range, :filters, :size
|
|
49
|
+
def initialize(payload)
|
|
50
|
+
@time_range = payload["time_range"]
|
|
51
|
+
@filters = payload["filters"]
|
|
52
|
+
@size = payload["size"]
|
|
53
|
+
end
|
|
54
|
+
def to_json(options = {})
|
|
55
|
+
{
|
|
56
|
+
"time_range": @time_range,
|
|
57
|
+
"filters": @filters,
|
|
58
|
+
"size": @size,
|
|
59
|
+
}.to_json(options)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
class InsightsV2CreatePhoneNumbersReportRequestTimeRange
|
|
64
|
+
# @param [start_time]: [Time] Start time of the report
|
|
65
|
+
# @param [end_time]: [Time] End time of the report
|
|
66
|
+
attr_accessor :start_time, :end_time
|
|
67
|
+
def initialize(payload)
|
|
68
|
+
@start_time = payload["start_time"]
|
|
69
|
+
@end_time = payload["end_time"]
|
|
70
|
+
end
|
|
71
|
+
def to_json(options = {})
|
|
72
|
+
{
|
|
73
|
+
"start_time": @start_time,
|
|
74
|
+
"end_time": @end_time,
|
|
75
|
+
}.to_json(options)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
class PhoneNumberReportFilter
|
|
80
|
+
# @param [key]: [String] The name of the filter
|
|
81
|
+
# @param [values]: [Array<String>] List of supported filter values for the field name
|
|
82
|
+
attr_accessor :key, :values
|
|
83
|
+
def initialize(payload)
|
|
84
|
+
@key = payload["key"]
|
|
85
|
+
@values = payload["values"]
|
|
86
|
+
end
|
|
87
|
+
def to_json(options = {})
|
|
88
|
+
{
|
|
89
|
+
"key": @key,
|
|
90
|
+
"values": @values,
|
|
91
|
+
}.to_json(options)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
class ReportFilter
|
|
96
|
+
# @param [key]: [String] The name of the filter 'call_state', 'call_direction', 'call_type', 'twilio_regions', 'caller_country_code', 'callee_country_code', 'silent'
|
|
97
|
+
# @param [values]: [Array<String>] List of supported filter values for the field name
|
|
98
|
+
attr_accessor :key, :values
|
|
99
|
+
def initialize(payload)
|
|
100
|
+
@key = payload["key"]
|
|
101
|
+
@values = payload["values"]
|
|
102
|
+
end
|
|
103
|
+
def to_json(options = {})
|
|
104
|
+
{
|
|
105
|
+
"key": @key,
|
|
106
|
+
"values": @values,
|
|
107
|
+
}.to_json(options)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
##
|
|
113
|
+
# Initialize the OutboundList
|
|
114
|
+
# @param [Version] version Version that contains the resource
|
|
115
|
+
# @return [OutboundList] OutboundList
|
|
116
|
+
def initialize(version, report_id: nil)
|
|
117
|
+
super(version)
|
|
118
|
+
|
|
119
|
+
# Path Solution
|
|
120
|
+
@solution = { report_id: report_id }
|
|
121
|
+
@uri = "/Voice/Reports/PhoneNumbers/Outbound/#{@solution[:report_id]}"
|
|
122
|
+
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
##
|
|
126
|
+
# Lists OutboundInstance records from the API as a list.
|
|
127
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
128
|
+
# memory before returning.
|
|
129
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
130
|
+
# guarantees to never return more than limit. Default is no limit
|
|
131
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
132
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
133
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
134
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
135
|
+
# @return [Array] Array of up to limit results
|
|
136
|
+
def list(limit: nil, page_size: nil)
|
|
137
|
+
self.stream(
|
|
138
|
+
limit: limit,
|
|
139
|
+
page_size: page_size
|
|
140
|
+
).entries
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
##
|
|
144
|
+
# Streams Instance records from the API as an Enumerable.
|
|
145
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
146
|
+
# is reached.
|
|
147
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
148
|
+
# guarantees to never return more than limit. Default is no limit
|
|
149
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
150
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
151
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
152
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
153
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
154
|
+
def stream(limit: nil, page_size: nil)
|
|
155
|
+
limits = @version.read_limits(limit, page_size)
|
|
156
|
+
|
|
157
|
+
page = self.page(
|
|
158
|
+
page_size: limits[:page_size], )
|
|
159
|
+
|
|
160
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
##
|
|
164
|
+
# Lists OutboundPageMetadata records from the API as a list.
|
|
165
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
166
|
+
# guarantees to never return more than limit. Default is no limit
|
|
167
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
168
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
169
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
170
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
171
|
+
# @return [Array] Array of up to limit results
|
|
172
|
+
def list_with_metadata(limit: nil, page_size: nil)
|
|
173
|
+
limits = @version.read_limits(limit, page_size)
|
|
174
|
+
params = Twilio::Values.of({
|
|
175
|
+
|
|
176
|
+
'PageSize' => limits[:page_size],
|
|
177
|
+
});
|
|
178
|
+
headers = Twilio::Values.of({})
|
|
179
|
+
|
|
180
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
181
|
+
|
|
182
|
+
OutboundPageMetadata.new(@version, response, @solution, limits[:limit])
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
##
|
|
186
|
+
# When passed a block, yields OutboundInstance records from the API.
|
|
187
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
188
|
+
# is reached.
|
|
189
|
+
def each
|
|
190
|
+
limits = @version.read_limits
|
|
191
|
+
|
|
192
|
+
page = self.page(page_size: limits[:page_size], )
|
|
193
|
+
|
|
194
|
+
@version.stream(page,
|
|
195
|
+
limit: limits[:limit],
|
|
196
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
##
|
|
200
|
+
# Retrieve a single page of OutboundInstance records from the API.
|
|
201
|
+
# Request is executed immediately.
|
|
202
|
+
# @param [String] page_token PageToken provided by the API
|
|
203
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
204
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
205
|
+
# @return [Page] Page of OutboundInstance
|
|
206
|
+
def page(page_token: :unset, page_number: :unset,page_size: :unset)
|
|
207
|
+
params = Twilio::Values.of({
|
|
208
|
+
'PageToken' => page_token,
|
|
209
|
+
'Page' => page_number,
|
|
210
|
+
'PageSize' => page_size,
|
|
211
|
+
})
|
|
212
|
+
headers = Twilio::Values.of({})
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
response = @version.page('GET', @uri, params: params, headers: headers)
|
|
217
|
+
|
|
218
|
+
OutboundPage.new(@version, response, @solution)
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
##
|
|
222
|
+
# Retrieve a single page of OutboundInstance records from the API.
|
|
223
|
+
# Request is executed immediately.
|
|
224
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
225
|
+
# @return [Page] Page of OutboundInstance
|
|
226
|
+
def get_page(target_url)
|
|
227
|
+
response = @version.domain.request(
|
|
228
|
+
'GET',
|
|
229
|
+
target_url
|
|
230
|
+
)
|
|
231
|
+
OutboundPage.new(@version, response, @solution)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
# Provide a user friendly representation
|
|
237
|
+
def to_s
|
|
238
|
+
'#<Twilio.Insights.V2.OutboundList>'
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class OutboundContext < InstanceContext
|
|
244
|
+
##
|
|
245
|
+
# Initialize the OutboundContext
|
|
246
|
+
# @param [Version] version Version that contains the resource
|
|
247
|
+
# @param [String] report_id A unique Report Id.
|
|
248
|
+
# @return [OutboundContext] OutboundContext
|
|
249
|
+
def initialize(version, report_id)
|
|
250
|
+
super(version)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
# Path Solution
|
|
254
|
+
@solution = { report_id: report_id, }
|
|
255
|
+
@uri = "/Voice/Reports/PhoneNumbers/Outbound"
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
end
|
|
259
|
+
##
|
|
260
|
+
# Create the OutboundInstance
|
|
261
|
+
# @param [InsightsV2CreatePhoneNumbersReportRequest] insights_v2_create_phone_numbers_report_request
|
|
262
|
+
# @return [OutboundInstance] Created OutboundInstance
|
|
263
|
+
def create(insights_v2_create_phone_numbers_report_request: :unset
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
267
|
+
headers['Content-Type'] = 'application/json'
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
payload = @version.create('POST', @uri, headers: headers, data: insights_v2_create_phone_numbers_report_request.to_json)
|
|
273
|
+
OutboundInstance.new(
|
|
274
|
+
@version,
|
|
275
|
+
payload,
|
|
276
|
+
report_id: @solution[:report_id],
|
|
277
|
+
)
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
##
|
|
281
|
+
# Create the OutboundInstanceMetadata
|
|
282
|
+
# @param [InsightsV2CreatePhoneNumbersReportRequest] insights_v2_create_phone_numbers_report_request
|
|
283
|
+
# @return [OutboundInstance] Created OutboundInstance
|
|
284
|
+
def create_with_metadata(insights_v2_create_phone_numbers_report_request: :unset
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
|
|
288
|
+
headers['Content-Type'] = 'application/json'
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
response = @version.create_with_metadata('POST', @uri, headers: headers, data: insights_v2_create_phone_numbers_report_request.to_json)
|
|
294
|
+
outbound_instance = OutboundInstance.new(
|
|
295
|
+
@version,
|
|
296
|
+
response.body,
|
|
297
|
+
report_id: @solution[:report_id],
|
|
298
|
+
)
|
|
299
|
+
OutboundInstanceMetadata.new(
|
|
300
|
+
@version,
|
|
301
|
+
outbound_instance,
|
|
302
|
+
response.headers,
|
|
303
|
+
response.status_code
|
|
304
|
+
)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
##
|
|
309
|
+
# Provide a user friendly representation
|
|
310
|
+
def to_s
|
|
311
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
312
|
+
"#<Twilio.Insights.V2.OutboundContext #{context}>"
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
##
|
|
316
|
+
# Provide a detailed, user friendly representation
|
|
317
|
+
def inspect
|
|
318
|
+
context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
|
|
319
|
+
"#<Twilio.Insights.V2.OutboundContext #{context}>"
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
class OutboundInstanceMetadata < InstanceResourceMetadata
|
|
324
|
+
##
|
|
325
|
+
# Initializes a new OutboundInstanceMetadata.
|
|
326
|
+
# @param [Version] version Version that contains the resource
|
|
327
|
+
# @param [}OutboundInstance] outbound_instance The instance associated with the metadata.
|
|
328
|
+
# @param [Hash] headers Header object with response headers.
|
|
329
|
+
# @param [Integer] status_code The HTTP status code of the response.
|
|
330
|
+
# @return [OutboundInstanceMetadata] The initialized instance with metadata.
|
|
331
|
+
def initialize(version, outbound_instance, headers, status_code)
|
|
332
|
+
super(version, headers, status_code)
|
|
333
|
+
@outbound_instance = outbound_instance
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def outbound
|
|
337
|
+
@outbound_instance
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
def headers
|
|
341
|
+
@headers
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
def status_code
|
|
345
|
+
@status_code
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def to_s
|
|
349
|
+
"<Twilio.Api.V2010.OutboundInstanceMetadata status=#{@status_code}>"
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
class OutboundListResponse < InstanceListResource
|
|
354
|
+
# @param [Array<OutboundInstance>] instance
|
|
355
|
+
# @param [Hash{String => Object}] headers
|
|
356
|
+
# @param [Integer] status_code
|
|
357
|
+
def initialize(version, payload, key)
|
|
358
|
+
@outbound_instance = payload.body[key].map do |data|
|
|
359
|
+
OutboundInstance.new(version, data)
|
|
360
|
+
end
|
|
361
|
+
@headers = payload.headers
|
|
362
|
+
@status_code = payload.status_code
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
def outbound_instance
|
|
366
|
+
@instance
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
class OutboundPage < Page
|
|
371
|
+
##
|
|
372
|
+
# Initialize the OutboundPage
|
|
373
|
+
# @param [Version] version Version that contains the resource
|
|
374
|
+
# @param [Response] response Response from the API
|
|
375
|
+
# @param [Hash] solution Path solution for the resource
|
|
376
|
+
# @return [OutboundPage] OutboundPage
|
|
377
|
+
def initialize(version, response, solution)
|
|
378
|
+
super(version, response)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
# Path Solution
|
|
382
|
+
@solution = solution
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
##
|
|
386
|
+
# Build an instance of OutboundInstance
|
|
387
|
+
# @param [Hash] payload Payload response from the API
|
|
388
|
+
# @return [OutboundInstance] OutboundInstance
|
|
389
|
+
def get_instance(payload)
|
|
390
|
+
OutboundInstance.new(@version, payload, report_id: @solution[:report_id])
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
##
|
|
394
|
+
# Provide a user friendly representation
|
|
395
|
+
def to_s
|
|
396
|
+
'<Twilio.Insights.V2.OutboundPage>'
|
|
397
|
+
end
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
class OutboundPageMetadata < PageMetadata
|
|
401
|
+
attr_reader :outbound_page
|
|
402
|
+
|
|
403
|
+
def initialize(version, response, solution, limit)
|
|
404
|
+
super(version, response)
|
|
405
|
+
@outbound_page = []
|
|
406
|
+
@limit = limit
|
|
407
|
+
key = get_key(response.body)
|
|
408
|
+
records = 0
|
|
409
|
+
while( limit != :unset && records < limit )
|
|
410
|
+
@outbound_page << OutboundListResponse.new(version, @payload, key, limit - records)
|
|
411
|
+
@payload = self.next_page
|
|
412
|
+
break unless @payload
|
|
413
|
+
records += @payload.body[key].size
|
|
414
|
+
end
|
|
415
|
+
# Path Solution
|
|
416
|
+
@solution = solution
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
def each
|
|
420
|
+
@outbound_page.each do |record|
|
|
421
|
+
yield record
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def to_s
|
|
426
|
+
'<Twilio::REST::Insights::V2PageMetadata>';
|
|
427
|
+
end
|
|
428
|
+
end
|
|
429
|
+
class OutboundListResponse < InstanceListResource
|
|
430
|
+
|
|
431
|
+
# @param [Array<OutboundInstance>] instance
|
|
432
|
+
# @param [Hash{String => Object}] headers
|
|
433
|
+
# @param [Integer] status_code
|
|
434
|
+
def initialize(version, payload, key, limit = :unset)
|
|
435
|
+
data_list = payload.body[key]
|
|
436
|
+
if limit != :unset
|
|
437
|
+
data_list = data_list[0, limit]
|
|
438
|
+
end
|
|
439
|
+
@outbound = data_list.map do |data|
|
|
440
|
+
OutboundInstance.new(version, data)
|
|
441
|
+
end
|
|
442
|
+
@headers = payload.headers
|
|
443
|
+
@status_code = payload.status_code
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
def outbound
|
|
447
|
+
@outbound
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
def headers
|
|
451
|
+
@headers
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
def status_code
|
|
455
|
+
@status_code
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
class OutboundInstance < InstanceResource
|
|
460
|
+
##
|
|
461
|
+
# Initialize the OutboundInstance
|
|
462
|
+
# @param [Version] version Version that contains the resource
|
|
463
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
464
|
+
# @param [String] account_sid The SID of the
|
|
465
|
+
# {Account}[https://www.twilio.com/docs/iam/api/account] that created this Outbound
|
|
466
|
+
# resource.
|
|
467
|
+
# @param [String] sid The SID of the Call resource to fetch.
|
|
468
|
+
# @return [OutboundInstance] OutboundInstance
|
|
469
|
+
def initialize(version, payload , report_id: nil)
|
|
470
|
+
super(version)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
# Marshaled Properties
|
|
474
|
+
@properties = {
|
|
475
|
+
'account_sid' => payload['account_sid'],
|
|
476
|
+
'report_id' => payload['report_id'],
|
|
477
|
+
'status' => payload['status'],
|
|
478
|
+
'request_meta' => payload['request_meta'],
|
|
479
|
+
'url' => payload['url'],
|
|
480
|
+
'handle' => payload['handle'],
|
|
481
|
+
'total_calls' => payload['total_calls'] == nil ? payload['total_calls'] : payload['total_calls'].to_i,
|
|
482
|
+
'call_answer_score' => payload['call_answer_score'],
|
|
483
|
+
'call_state_percentage' => payload['call_state_percentage'],
|
|
484
|
+
'silent_calls_percentage' => payload['silent_calls_percentage'],
|
|
485
|
+
'calls_by_device_type' => payload['calls_by_device_type'],
|
|
486
|
+
'answer_rate_device_type' => payload['answer_rate_device_type'],
|
|
487
|
+
'blocked_calls_by_carrier' => payload['blocked_calls_by_carrier'],
|
|
488
|
+
'short_duration_calls_percentage' => payload['short_duration_calls_percentage'],
|
|
489
|
+
'long_duration_calls_percentage' => payload['long_duration_calls_percentage'],
|
|
490
|
+
'potential_robocalls_percentage' => payload['potential_robocalls_percentage'],
|
|
491
|
+
'answering_machine_detection' => payload['answering_machine_detection'],
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
# Context
|
|
495
|
+
@instance_context = nil
|
|
496
|
+
@params = { 'report_id' => report_id || @properties['report_id'] , }
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
##
|
|
500
|
+
# Generate an instance context for the instance, the context is capable of
|
|
501
|
+
# performing various actions. All instance actions are proxied to the context
|
|
502
|
+
# @return [OutboundContext] CallContext for this CallInstance
|
|
503
|
+
def context
|
|
504
|
+
unless @instance_context
|
|
505
|
+
@instance_context = OutboundContext.new(@version , @params['report_id'])
|
|
506
|
+
end
|
|
507
|
+
@instance_context
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
##
|
|
511
|
+
# @return [String] The unique SID identifier of the Account.
|
|
512
|
+
def account_sid
|
|
513
|
+
@properties['account_sid']
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
##
|
|
517
|
+
# @return [String] The report identifier as Voice Insights Report TTID.
|
|
518
|
+
def report_id
|
|
519
|
+
@properties['report_id']
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
##
|
|
523
|
+
# @return [ReportStatus]
|
|
524
|
+
def status
|
|
525
|
+
@properties['status']
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
##
|
|
529
|
+
# @return [ReportMetadata]
|
|
530
|
+
def request_meta
|
|
531
|
+
@properties['request_meta']
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
##
|
|
535
|
+
# @return [String] The URL of this resource.
|
|
536
|
+
def url
|
|
537
|
+
@properties['url']
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
##
|
|
541
|
+
# @return [String] Inbound phone number handle represented in the report.
|
|
542
|
+
def handle
|
|
543
|
+
@properties['handle']
|
|
544
|
+
end
|
|
545
|
+
|
|
546
|
+
##
|
|
547
|
+
# @return [String] Total number of calls made with the given handle during the report period.
|
|
548
|
+
def total_calls
|
|
549
|
+
@properties['total_calls']
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
##
|
|
553
|
+
# @return [Float] The call answer score measures customers behavior to the delivered calls. The score is a value between 0 and 100, where 100 indicates that all calls were successfully answered.
|
|
554
|
+
def call_answer_score
|
|
555
|
+
@properties['call_answer_score']
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
##
|
|
559
|
+
# @return [InsightsV2InboundPhoneNumberReportCallStatePercentage]
|
|
560
|
+
def call_state_percentage
|
|
561
|
+
@properties['call_state_percentage']
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
##
|
|
565
|
+
# @return [Float] Percentage of inbound calls with silence tags over total outbound calls. A silent tag is indicative of a connectivity issue or muted audio.
|
|
566
|
+
def silent_calls_percentage
|
|
567
|
+
@properties['silent_calls_percentage']
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
##
|
|
571
|
+
# @return [Hash<String, Integer>] Number of calls made with each device type. `voip`, `mobile`, `landline`, `unknown`
|
|
572
|
+
def calls_by_device_type
|
|
573
|
+
@properties['calls_by_device_type']
|
|
574
|
+
end
|
|
575
|
+
|
|
576
|
+
##
|
|
577
|
+
# @return [Hash<String, Float>] Answer rate for each device type. `voip`, `mobile`, `landline`, `unknown`
|
|
578
|
+
def answer_rate_device_type
|
|
579
|
+
@properties['answer_rate_device_type']
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
##
|
|
583
|
+
# @return [Array<CountyCarrierValue>] Percentage of blocked calls by carrier per country.
|
|
584
|
+
def blocked_calls_by_carrier
|
|
585
|
+
@properties['blocked_calls_by_carrier']
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
##
|
|
589
|
+
# @return [Float] Percentage of completed outbound calls under 10 seconds (PSTN Short call tags); More than 15% is typically low trust measured.
|
|
590
|
+
def short_duration_calls_percentage
|
|
591
|
+
@properties['short_duration_calls_percentage']
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
##
|
|
595
|
+
# @return [Float] Percentage of long duration calls ( >= 60 seconds)
|
|
596
|
+
def long_duration_calls_percentage
|
|
597
|
+
@properties['long_duration_calls_percentage']
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
##
|
|
601
|
+
# @return [Float] Percentage of completed outbound calls to unassigned or unallocated phone numbers.
|
|
602
|
+
def potential_robocalls_percentage
|
|
603
|
+
@properties['potential_robocalls_percentage']
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
##
|
|
607
|
+
# @return [InsightsV2OutboundPhoneNumberReportAnsweringMachineDetection]
|
|
608
|
+
def answering_machine_detection
|
|
609
|
+
@properties['answering_machine_detection']
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
##
|
|
613
|
+
# Create the OutboundInstance
|
|
614
|
+
# @param [InsightsV2CreatePhoneNumbersReportRequest] insights_v2_create_phone_numbers_report_request
|
|
615
|
+
# @return [OutboundInstance] Created OutboundInstance
|
|
616
|
+
def create(insights_v2_create_phone_numbers_report_request: :unset
|
|
617
|
+
)
|
|
618
|
+
|
|
619
|
+
context.create(
|
|
620
|
+
)
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
##
|
|
624
|
+
# Provide a user friendly representation
|
|
625
|
+
def to_s
|
|
626
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
627
|
+
"<Twilio.Insights.V2.OutboundInstance #{values}>"
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
##
|
|
631
|
+
# Provide a detailed, user friendly representation
|
|
632
|
+
def inspect
|
|
633
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
634
|
+
"<Twilio.Insights.V2.OutboundInstance #{values}>"
|
|
635
|
+
end
|
|
636
|
+
end
|
|
637
|
+
|
|
638
|
+
end
|
|
639
|
+
end
|
|
640
|
+
end
|
|
641
|
+
end
|