twilio-ruby 5.29.0 → 5.29.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -0
  3. data/CHANGES.md +31 -0
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +6 -2
  6. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +2 -1
  7. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +9 -7
  8. data/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +16 -0
  9. data/lib/twilio-ruby/rest/autopilot/v1/assistant/export_assistant.rb +222 -0
  10. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +18 -6
  11. data/lib/twilio-ruby/rest/insights.rb +5 -5
  12. data/lib/twilio-ruby/rest/insights/v1.rb +10 -10
  13. data/lib/twilio-ruby/rest/insights/v1/call.rb +242 -0
  14. data/lib/twilio-ruby/rest/insights/v1/call/event.rb +278 -0
  15. data/lib/twilio-ruby/rest/insights/v1/call/metric.rb +268 -0
  16. data/lib/twilio-ruby/rest/insights/v1/call/summary.rb +305 -0
  17. data/lib/twilio-ruby/rest/preview.rb +5 -4
  18. data/lib/twilio-ruby/rest/preview/marketplace.rb +2 -4
  19. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on.rb +9 -11
  20. data/lib/twilio-ruby/rest/preview/marketplace/available_add_on/available_add_on_extension.rb +14 -11
  21. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on.rb +27 -30
  22. data/lib/twilio-ruby/rest/preview/marketplace/installed_add_on/installed_add_on_extension.rb +17 -14
  23. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +9 -5
  24. data/lib/twilio-ruby/twiml/voice_response.rb +42 -0
  25. data/lib/twilio-ruby/version.rb +1 -1
  26. data/spec/integration/api/v2010/account/call_spec.rb +263 -45
  27. data/spec/integration/autopilot/v1/assistant/export_assistant_spec.rb +49 -0
  28. data/spec/integration/autopilot/v1/assistant_spec.rb +8 -4
  29. data/spec/integration/flex_api/v1/flex_flow_spec.rb +8 -4
  30. data/spec/integration/insights/v1/call/event_spec.rb +171 -0
  31. data/spec/integration/insights/v1/call/metric_spec.rb +159 -0
  32. data/spec/integration/insights/v1/{summary_spec.rb → call/summary_spec.rb} +4 -2
  33. data/spec/integration/insights/v1/call_spec.rb +47 -0
  34. data/spec/integration/verify/v2/service/verification_spec.rb +36 -0
  35. metadata +17 -5
  36. data/lib/twilio-ruby/rest/insights/v1/summary.rb +0 -302
@@ -0,0 +1,268 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Insights < Domain
12
+ class V1 < Version
13
+ class CallContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class MetricList < ListResource
17
+ ##
18
+ # Initialize the MetricList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] call_sid The call_sid
21
+ # @return [MetricList] MetricList
22
+ def initialize(version, call_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {call_sid: call_sid}
27
+ @uri = "/Voice/#{@solution[:call_sid]}/Metrics"
28
+ end
29
+
30
+ ##
31
+ # Lists MetricInstance records from the API as a list.
32
+ # Unlike stream(), this operation is eager and will load `limit` records into
33
+ # memory before returning.
34
+ # @param [metric.TwilioEdge] edge The edge
35
+ # @param [metric.StreamDirection] direction The direction
36
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
37
+ # guarantees to never return more than limit. Default is no limit
38
+ # @param [Integer] page_size Number of records to fetch per request, when
39
+ # not set will use the default value of 50 records. If no page_size is defined
40
+ # but a limit is defined, stream() will attempt to read the limit with the most
41
+ # efficient page size, i.e. min(limit, 1000)
42
+ # @return [Array] Array of up to limit results
43
+ def list(edge: :unset, direction: :unset, limit: nil, page_size: nil)
44
+ self.stream(edge: edge, direction: direction, limit: limit, page_size: page_size).entries
45
+ end
46
+
47
+ ##
48
+ # Streams MetricInstance records from the API as an Enumerable.
49
+ # This operation lazily loads records as efficiently as possible until the limit
50
+ # is reached.
51
+ # @param [metric.TwilioEdge] edge The edge
52
+ # @param [metric.StreamDirection] direction The direction
53
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
54
+ # guarantees to never return more than limit. Default is no limit.
55
+ # @param [Integer] page_size Number of records to fetch per request, when
56
+ # not set will use the default value of 50 records. If no page_size is defined
57
+ # but a limit is defined, stream() will attempt to read the limit with the most
58
+ # efficient page size, i.e. min(limit, 1000)
59
+ # @return [Enumerable] Enumerable that will yield up to limit results
60
+ def stream(edge: :unset, direction: :unset, limit: nil, page_size: nil)
61
+ limits = @version.read_limits(limit, page_size)
62
+
63
+ page = self.page(edge: edge, direction: direction, page_size: limits[:page_size], )
64
+
65
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
66
+ end
67
+
68
+ ##
69
+ # When passed a block, yields MetricInstance records from the API.
70
+ # This operation lazily loads records as efficiently as possible until the limit
71
+ # is reached.
72
+ def each
73
+ limits = @version.read_limits
74
+
75
+ page = self.page(page_size: limits[:page_size], )
76
+
77
+ @version.stream(page,
78
+ limit: limits[:limit],
79
+ page_limit: limits[:page_limit]).each {|x| yield x}
80
+ end
81
+
82
+ ##
83
+ # Retrieve a single page of MetricInstance records from the API.
84
+ # Request is executed immediately.
85
+ # @param [metric.TwilioEdge] edge The edge
86
+ # @param [metric.StreamDirection] direction The direction
87
+ # @param [String] page_token PageToken provided by the API
88
+ # @param [Integer] page_number Page Number, this value is simply for client state
89
+ # @param [Integer] page_size Number of records to return, defaults to 50
90
+ # @return [Page] Page of MetricInstance
91
+ def page(edge: :unset, direction: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
92
+ params = Twilio::Values.of({
93
+ 'Edge' => edge,
94
+ 'Direction' => direction,
95
+ 'PageToken' => page_token,
96
+ 'Page' => page_number,
97
+ 'PageSize' => page_size,
98
+ })
99
+ response = @version.page(
100
+ 'GET',
101
+ @uri,
102
+ params
103
+ )
104
+ MetricPage.new(@version, response, @solution)
105
+ end
106
+
107
+ ##
108
+ # Retrieve a single page of MetricInstance records from the API.
109
+ # Request is executed immediately.
110
+ # @param [String] target_url API-generated URL for the requested results page
111
+ # @return [Page] Page of MetricInstance
112
+ def get_page(target_url)
113
+ response = @version.domain.request(
114
+ 'GET',
115
+ target_url
116
+ )
117
+ MetricPage.new(@version, response, @solution)
118
+ end
119
+
120
+ ##
121
+ # Provide a user friendly representation
122
+ def to_s
123
+ '#<Twilio.Insights.V1.MetricList>'
124
+ end
125
+ end
126
+
127
+ ##
128
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
129
+ class MetricPage < Page
130
+ ##
131
+ # Initialize the MetricPage
132
+ # @param [Version] version Version that contains the resource
133
+ # @param [Response] response Response from the API
134
+ # @param [Hash] solution Path solution for the resource
135
+ # @return [MetricPage] MetricPage
136
+ def initialize(version, response, solution)
137
+ super(version, response)
138
+
139
+ # Path Solution
140
+ @solution = solution
141
+ end
142
+
143
+ ##
144
+ # Build an instance of MetricInstance
145
+ # @param [Hash] payload Payload response from the API
146
+ # @return [MetricInstance] MetricInstance
147
+ def get_instance(payload)
148
+ MetricInstance.new(@version, payload, call_sid: @solution[:call_sid], )
149
+ end
150
+
151
+ ##
152
+ # Provide a user friendly representation
153
+ def to_s
154
+ '<Twilio.Insights.V1.MetricPage>'
155
+ end
156
+ end
157
+
158
+ ##
159
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
160
+ class MetricInstance < InstanceResource
161
+ ##
162
+ # Initialize the MetricInstance
163
+ # @param [Version] version Version that contains the resource
164
+ # @param [Hash] payload payload that contains response from Twilio
165
+ # @param [String] call_sid The call_sid
166
+ # @return [MetricInstance] MetricInstance
167
+ def initialize(version, payload, call_sid: nil)
168
+ super(version)
169
+
170
+ # Marshaled Properties
171
+ @properties = {
172
+ 'timestamp' => payload['timestamp'],
173
+ 'call_sid' => payload['call_sid'],
174
+ 'account_sid' => payload['account_sid'],
175
+ 'edge' => payload['edge'],
176
+ 'direction' => payload['direction'],
177
+ 'gateway' => payload['gateway'],
178
+ 'client' => payload['client'],
179
+ 'carrier_edge' => payload['carrier_edge'],
180
+ 'sip_edge' => payload['sip_edge'],
181
+ 'sdk_edge' => payload['sdk_edge'],
182
+ 'client_edge' => payload['client_edge'],
183
+ }
184
+ end
185
+
186
+ ##
187
+ # @return [String] The timestamp
188
+ def timestamp
189
+ @properties['timestamp']
190
+ end
191
+
192
+ ##
193
+ # @return [String] The call_sid
194
+ def call_sid
195
+ @properties['call_sid']
196
+ end
197
+
198
+ ##
199
+ # @return [String] The account_sid
200
+ def account_sid
201
+ @properties['account_sid']
202
+ end
203
+
204
+ ##
205
+ # @return [metric.TwilioEdge] The edge
206
+ def edge
207
+ @properties['edge']
208
+ end
209
+
210
+ ##
211
+ # @return [metric.StreamDirection] The direction
212
+ def direction
213
+ @properties['direction']
214
+ end
215
+
216
+ ##
217
+ # @return [Hash] The gateway
218
+ def gateway
219
+ @properties['gateway']
220
+ end
221
+
222
+ ##
223
+ # @return [Hash] The client
224
+ def client
225
+ @properties['client']
226
+ end
227
+
228
+ ##
229
+ # @return [Hash] The carrier_edge
230
+ def carrier_edge
231
+ @properties['carrier_edge']
232
+ end
233
+
234
+ ##
235
+ # @return [Hash] The sip_edge
236
+ def sip_edge
237
+ @properties['sip_edge']
238
+ end
239
+
240
+ ##
241
+ # @return [Hash] The sdk_edge
242
+ def sdk_edge
243
+ @properties['sdk_edge']
244
+ end
245
+
246
+ ##
247
+ # @return [Hash] The client_edge
248
+ def client_edge
249
+ @properties['client_edge']
250
+ end
251
+
252
+ ##
253
+ # Provide a user friendly representation
254
+ def to_s
255
+ "<Twilio.Insights.V1.MetricInstance>"
256
+ end
257
+
258
+ ##
259
+ # Provide a detailed, user friendly representation
260
+ def inspect
261
+ "<Twilio.Insights.V1.MetricInstance>"
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
@@ -0,0 +1,305 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Insights < Domain
12
+ class V1 < Version
13
+ class CallContext < InstanceContext
14
+ ##
15
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
+ class CallSummaryList < ListResource
17
+ ##
18
+ # Initialize the CallSummaryList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] call_sid The call_sid
21
+ # @return [CallSummaryList] CallSummaryList
22
+ def initialize(version, call_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {call_sid: call_sid}
27
+ end
28
+
29
+ ##
30
+ # Provide a user friendly representation
31
+ def to_s
32
+ '#<Twilio.Insights.V1.CallSummaryList>'
33
+ end
34
+ end
35
+
36
+ ##
37
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
38
+ class CallSummaryPage < Page
39
+ ##
40
+ # Initialize the CallSummaryPage
41
+ # @param [Version] version Version that contains the resource
42
+ # @param [Response] response Response from the API
43
+ # @param [Hash] solution Path solution for the resource
44
+ # @return [CallSummaryPage] CallSummaryPage
45
+ def initialize(version, response, solution)
46
+ super(version, response)
47
+
48
+ # Path Solution
49
+ @solution = solution
50
+ end
51
+
52
+ ##
53
+ # Build an instance of CallSummaryInstance
54
+ # @param [Hash] payload Payload response from the API
55
+ # @return [CallSummaryInstance] CallSummaryInstance
56
+ def get_instance(payload)
57
+ CallSummaryInstance.new(@version, payload, call_sid: @solution[:call_sid], )
58
+ end
59
+
60
+ ##
61
+ # Provide a user friendly representation
62
+ def to_s
63
+ '<Twilio.Insights.V1.CallSummaryPage>'
64
+ end
65
+ end
66
+
67
+ ##
68
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
69
+ class CallSummaryContext < InstanceContext
70
+ ##
71
+ # Initialize the CallSummaryContext
72
+ # @param [Version] version Version that contains the resource
73
+ # @param [String] call_sid The call_sid
74
+ # @return [CallSummaryContext] CallSummaryContext
75
+ def initialize(version, call_sid)
76
+ super(version)
77
+
78
+ # Path Solution
79
+ @solution = {call_sid: call_sid, }
80
+ @uri = "/Voice/#{@solution[:call_sid]}/Summary"
81
+ end
82
+
83
+ ##
84
+ # Fetch a CallSummaryInstance
85
+ # @param [call_summary.ProcessingState] processing_state The processing_state
86
+ # @return [CallSummaryInstance] Fetched CallSummaryInstance
87
+ def fetch(processing_state: :unset)
88
+ params = Twilio::Values.of({'ProcessingState' => processing_state, })
89
+
90
+ payload = @version.fetch(
91
+ 'GET',
92
+ @uri,
93
+ params,
94
+ )
95
+
96
+ CallSummaryInstance.new(@version, payload, call_sid: @solution[:call_sid], )
97
+ end
98
+
99
+ ##
100
+ # Provide a user friendly representation
101
+ def to_s
102
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
103
+ "#<Twilio.Insights.V1.CallSummaryContext #{context}>"
104
+ end
105
+
106
+ ##
107
+ # Provide a detailed, user friendly representation
108
+ def inspect
109
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
110
+ "#<Twilio.Insights.V1.CallSummaryContext #{context}>"
111
+ end
112
+ end
113
+
114
+ ##
115
+ # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
116
+ class CallSummaryInstance < InstanceResource
117
+ ##
118
+ # Initialize the CallSummaryInstance
119
+ # @param [Version] version Version that contains the resource
120
+ # @param [Hash] payload payload that contains response from Twilio
121
+ # @param [String] call_sid The call_sid
122
+ # @return [CallSummaryInstance] CallSummaryInstance
123
+ def initialize(version, payload, call_sid: nil)
124
+ super(version)
125
+
126
+ # Marshaled Properties
127
+ @properties = {
128
+ 'account_sid' => payload['account_sid'],
129
+ 'call_sid' => payload['call_sid'],
130
+ 'call_type' => payload['call_type'],
131
+ 'call_state' => payload['call_state'],
132
+ 'processing_state' => payload['processing_state'],
133
+ 'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
134
+ 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
135
+ 'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
136
+ 'connect_duration' => payload['connect_duration'] == nil ? payload['connect_duration'] : payload['connect_duration'].to_i,
137
+ 'from' => payload['from'],
138
+ 'to' => payload['to'],
139
+ 'carrier_edge' => payload['carrier_edge'],
140
+ 'client_edge' => payload['client_edge'],
141
+ 'sdk_edge' => payload['sdk_edge'],
142
+ 'sip_edge' => payload['sip_edge'],
143
+ 'tags' => payload['tags'],
144
+ 'url' => payload['url'],
145
+ 'attributes' => payload['attributes'],
146
+ 'properties' => payload['properties'],
147
+ }
148
+
149
+ # Context
150
+ @instance_context = nil
151
+ @params = {'call_sid' => call_sid, }
152
+ end
153
+
154
+ ##
155
+ # Generate an instance context for the instance, the context is capable of
156
+ # performing various actions. All instance actions are proxied to the context
157
+ # @return [CallSummaryContext] CallSummaryContext for this CallSummaryInstance
158
+ def context
159
+ unless @instance_context
160
+ @instance_context = CallSummaryContext.new(@version, @params['call_sid'], )
161
+ end
162
+ @instance_context
163
+ end
164
+
165
+ ##
166
+ # @return [String] The account_sid
167
+ def account_sid
168
+ @properties['account_sid']
169
+ end
170
+
171
+ ##
172
+ # @return [String] The call_sid
173
+ def call_sid
174
+ @properties['call_sid']
175
+ end
176
+
177
+ ##
178
+ # @return [call_summary.CallType] The call_type
179
+ def call_type
180
+ @properties['call_type']
181
+ end
182
+
183
+ ##
184
+ # @return [call_summary.CallState] The call_state
185
+ def call_state
186
+ @properties['call_state']
187
+ end
188
+
189
+ ##
190
+ # @return [call_summary.ProcessingState] The processing_state
191
+ def processing_state
192
+ @properties['processing_state']
193
+ end
194
+
195
+ ##
196
+ # @return [Time] The start_time
197
+ def start_time
198
+ @properties['start_time']
199
+ end
200
+
201
+ ##
202
+ # @return [Time] The end_time
203
+ def end_time
204
+ @properties['end_time']
205
+ end
206
+
207
+ ##
208
+ # @return [String] The duration
209
+ def duration
210
+ @properties['duration']
211
+ end
212
+
213
+ ##
214
+ # @return [String] The connect_duration
215
+ def connect_duration
216
+ @properties['connect_duration']
217
+ end
218
+
219
+ ##
220
+ # @return [Hash] The from
221
+ def from
222
+ @properties['from']
223
+ end
224
+
225
+ ##
226
+ # @return [Hash] The to
227
+ def to
228
+ @properties['to']
229
+ end
230
+
231
+ ##
232
+ # @return [Hash] The carrier_edge
233
+ def carrier_edge
234
+ @properties['carrier_edge']
235
+ end
236
+
237
+ ##
238
+ # @return [Hash] The client_edge
239
+ def client_edge
240
+ @properties['client_edge']
241
+ end
242
+
243
+ ##
244
+ # @return [Hash] The sdk_edge
245
+ def sdk_edge
246
+ @properties['sdk_edge']
247
+ end
248
+
249
+ ##
250
+ # @return [Hash] The sip_edge
251
+ def sip_edge
252
+ @properties['sip_edge']
253
+ end
254
+
255
+ ##
256
+ # @return [String] The tags
257
+ def tags
258
+ @properties['tags']
259
+ end
260
+
261
+ ##
262
+ # @return [String] The url
263
+ def url
264
+ @properties['url']
265
+ end
266
+
267
+ ##
268
+ # @return [Hash] The attributes
269
+ def attributes
270
+ @properties['attributes']
271
+ end
272
+
273
+ ##
274
+ # @return [Hash] The properties
275
+ def properties
276
+ @properties['properties']
277
+ end
278
+
279
+ ##
280
+ # Fetch a CallSummaryInstance
281
+ # @param [call_summary.ProcessingState] processing_state The processing_state
282
+ # @return [CallSummaryInstance] Fetched CallSummaryInstance
283
+ def fetch(processing_state: :unset)
284
+ context.fetch(processing_state: processing_state, )
285
+ end
286
+
287
+ ##
288
+ # Provide a user friendly representation
289
+ def to_s
290
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
291
+ "<Twilio.Insights.V1.CallSummaryInstance #{values}>"
292
+ end
293
+
294
+ ##
295
+ # Provide a detailed, user friendly representation
296
+ def inspect
297
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
298
+ "<Twilio.Insights.V1.CallSummaryInstance #{values}>"
299
+ end
300
+ end
301
+ end
302
+ end
303
+ end
304
+ end
305
+ end