twilio-ruby 5.65.1 → 5.66.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +28 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/payment.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call/stream.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +10 -10
- data/lib/twilio-ruby/rest/chat/v3/channel.rb +275 -0
- data/lib/twilio-ruby/rest/chat/v3.rb +48 -0
- data/lib/twilio-ruby/rest/chat.rb +16 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.rb +236 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.rb +330 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +377 -0
- data/lib/twilio-ruby/rest/flex_api/v1/interaction.rb +233 -0
- data/lib/twilio-ruby/rest/flex_api/v1.rb +16 -0
- data/lib/twilio-ruby/rest/flex_api.rb +9 -0
- data/lib/twilio-ruby/rest/insights/v1/annotation.rb +271 -0
- data/lib/twilio-ruby/rest/insights/v1.rb +16 -0
- data/lib/twilio-ruby/rest/insights.rb +8 -0
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +1 -1
- data/lib/twilio-ruby/rest/media/v1/media_recording.rb +26 -5
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +14 -1
- data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +3 -55
- data/lib/twilio-ruby/rest/supersim/v1.rb +0 -16
- data/lib/twilio-ruby/rest/supersim.rb +0 -9
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +6 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +4 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +4 -2
- data/lib/twilio-ruby/rest/video/v1/composition.rb +14 -0
- data/lib/twilio-ruby/rest/video/v1/recording.rb +14 -0
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +9 -3
- data/lib/twilio-ruby/rest/supersim/v1/command.rb +0 -368
@@ -0,0 +1,377 @@
|
|
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 FlexApi < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class InteractionContext < InstanceContext
|
14
|
+
class InteractionChannelList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the InteractionChannelList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] interaction_sid The Interaction Sid for this channel.
|
19
|
+
# @return [InteractionChannelList] InteractionChannelList
|
20
|
+
def initialize(version, interaction_sid: nil)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {interaction_sid: interaction_sid}
|
25
|
+
@uri = "/Interactions/#{@solution[:interaction_sid]}/Channels"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists InteractionChannelInstance records from the API as a list.
|
30
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
31
|
+
# memory before returning.
|
32
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
33
|
+
# guarantees to never return more than limit. Default is no limit
|
34
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
35
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
36
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
37
|
+
# efficient page size, i.e. min(limit, 1000)
|
38
|
+
# @return [Array] Array of up to limit results
|
39
|
+
def list(limit: nil, page_size: nil)
|
40
|
+
self.stream(limit: limit, page_size: page_size).entries
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# Streams InteractionChannelInstance records from the API as an Enumerable.
|
45
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
46
|
+
# is reached.
|
47
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
48
|
+
# guarantees to never return more than limit. Default is no limit.
|
49
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
50
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
51
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
52
|
+
# efficient page size, i.e. min(limit, 1000)
|
53
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
54
|
+
def stream(limit: nil, page_size: nil)
|
55
|
+
limits = @version.read_limits(limit, page_size)
|
56
|
+
|
57
|
+
page = self.page(page_size: limits[:page_size], )
|
58
|
+
|
59
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# When passed a block, yields InteractionChannelInstance records from the API.
|
64
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
65
|
+
# is reached.
|
66
|
+
def each
|
67
|
+
limits = @version.read_limits
|
68
|
+
|
69
|
+
page = self.page(page_size: limits[:page_size], )
|
70
|
+
|
71
|
+
@version.stream(page,
|
72
|
+
limit: limits[:limit],
|
73
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
74
|
+
end
|
75
|
+
|
76
|
+
##
|
77
|
+
# Retrieve a single page of InteractionChannelInstance records from the API.
|
78
|
+
# Request is executed immediately.
|
79
|
+
# @param [String] page_token PageToken provided by the API
|
80
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
81
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
82
|
+
# @return [Page] Page of InteractionChannelInstance
|
83
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
84
|
+
params = Twilio::Values.of({
|
85
|
+
'PageToken' => page_token,
|
86
|
+
'Page' => page_number,
|
87
|
+
'PageSize' => page_size,
|
88
|
+
})
|
89
|
+
|
90
|
+
response = @version.page('GET', @uri, params: params)
|
91
|
+
|
92
|
+
InteractionChannelPage.new(@version, response, @solution)
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Retrieve a single page of InteractionChannelInstance records from the API.
|
97
|
+
# Request is executed immediately.
|
98
|
+
# @param [String] target_url API-generated URL for the requested results page
|
99
|
+
# @return [Page] Page of InteractionChannelInstance
|
100
|
+
def get_page(target_url)
|
101
|
+
response = @version.domain.request(
|
102
|
+
'GET',
|
103
|
+
target_url
|
104
|
+
)
|
105
|
+
InteractionChannelPage.new(@version, response, @solution)
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Provide a user friendly representation
|
110
|
+
def to_s
|
111
|
+
'#<Twilio.FlexApi.V1.InteractionChannelList>'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
class InteractionChannelPage < Page
|
116
|
+
##
|
117
|
+
# Initialize the InteractionChannelPage
|
118
|
+
# @param [Version] version Version that contains the resource
|
119
|
+
# @param [Response] response Response from the API
|
120
|
+
# @param [Hash] solution Path solution for the resource
|
121
|
+
# @return [InteractionChannelPage] InteractionChannelPage
|
122
|
+
def initialize(version, response, solution)
|
123
|
+
super(version, response)
|
124
|
+
|
125
|
+
# Path Solution
|
126
|
+
@solution = solution
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Build an instance of InteractionChannelInstance
|
131
|
+
# @param [Hash] payload Payload response from the API
|
132
|
+
# @return [InteractionChannelInstance] InteractionChannelInstance
|
133
|
+
def get_instance(payload)
|
134
|
+
InteractionChannelInstance.new(@version, payload, interaction_sid: @solution[:interaction_sid], )
|
135
|
+
end
|
136
|
+
|
137
|
+
##
|
138
|
+
# Provide a user friendly representation
|
139
|
+
def to_s
|
140
|
+
'<Twilio.FlexApi.V1.InteractionChannelPage>'
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class InteractionChannelContext < InstanceContext
|
145
|
+
##
|
146
|
+
# Initialize the InteractionChannelContext
|
147
|
+
# @param [Version] version Version that contains the resource
|
148
|
+
# @param [String] interaction_sid The Interaction Sid for this channel.
|
149
|
+
# @param [String] sid The Channel Sid for this Participant.
|
150
|
+
# @return [InteractionChannelContext] InteractionChannelContext
|
151
|
+
def initialize(version, interaction_sid, sid)
|
152
|
+
super(version)
|
153
|
+
|
154
|
+
# Path Solution
|
155
|
+
@solution = {interaction_sid: interaction_sid, sid: sid, }
|
156
|
+
@uri = "/Interactions/#{@solution[:interaction_sid]}/Channels/#{@solution[:sid]}"
|
157
|
+
|
158
|
+
# Dependents
|
159
|
+
@invites = nil
|
160
|
+
@participants = nil
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# Fetch the InteractionChannelInstance
|
165
|
+
# @return [InteractionChannelInstance] Fetched InteractionChannelInstance
|
166
|
+
def fetch
|
167
|
+
payload = @version.fetch('GET', @uri)
|
168
|
+
|
169
|
+
InteractionChannelInstance.new(
|
170
|
+
@version,
|
171
|
+
payload,
|
172
|
+
interaction_sid: @solution[:interaction_sid],
|
173
|
+
sid: @solution[:sid],
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Update the InteractionChannelInstance
|
179
|
+
# @param [interaction_channel.Status] status The Interaction Channel's status. Can
|
180
|
+
# be: `closed` or `wrapup`.
|
181
|
+
# @param [Hash] routing The Interaction Channel's routing parameters. Optional,
|
182
|
+
# may contain `status` to set the agent's Reservation state to either `closed` or
|
183
|
+
# `wrapup`. Default is `wrapup` if unspecified.
|
184
|
+
# @return [InteractionChannelInstance] Updated InteractionChannelInstance
|
185
|
+
def update(status: nil, routing: :unset)
|
186
|
+
data = Twilio::Values.of({'Status' => status, 'Routing' => Twilio.serialize_object(routing), })
|
187
|
+
|
188
|
+
payload = @version.update('POST', @uri, data: data)
|
189
|
+
|
190
|
+
InteractionChannelInstance.new(
|
191
|
+
@version,
|
192
|
+
payload,
|
193
|
+
interaction_sid: @solution[:interaction_sid],
|
194
|
+
sid: @solution[:sid],
|
195
|
+
)
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# Access the invites
|
200
|
+
# @return [InteractionChannelInviteList]
|
201
|
+
# @return [InteractionChannelInviteContext]
|
202
|
+
def invites
|
203
|
+
unless @invites
|
204
|
+
@invites = InteractionChannelInviteList.new(
|
205
|
+
@version,
|
206
|
+
interaction_sid: @solution[:interaction_sid],
|
207
|
+
channel_sid: @solution[:sid],
|
208
|
+
)
|
209
|
+
end
|
210
|
+
|
211
|
+
@invites
|
212
|
+
end
|
213
|
+
|
214
|
+
##
|
215
|
+
# Access the participants
|
216
|
+
# @return [InteractionChannelParticipantList]
|
217
|
+
# @return [InteractionChannelParticipantContext] if sid was passed.
|
218
|
+
def participants(sid=:unset)
|
219
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
220
|
+
|
221
|
+
if sid != :unset
|
222
|
+
return InteractionChannelParticipantContext.new(
|
223
|
+
@version,
|
224
|
+
@solution[:interaction_sid],
|
225
|
+
@solution[:sid],
|
226
|
+
sid,
|
227
|
+
)
|
228
|
+
end
|
229
|
+
|
230
|
+
unless @participants
|
231
|
+
@participants = InteractionChannelParticipantList.new(
|
232
|
+
@version,
|
233
|
+
interaction_sid: @solution[:interaction_sid],
|
234
|
+
channel_sid: @solution[:sid],
|
235
|
+
)
|
236
|
+
end
|
237
|
+
|
238
|
+
@participants
|
239
|
+
end
|
240
|
+
|
241
|
+
##
|
242
|
+
# Provide a user friendly representation
|
243
|
+
def to_s
|
244
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
245
|
+
"#<Twilio.FlexApi.V1.InteractionChannelContext #{context}>"
|
246
|
+
end
|
247
|
+
|
248
|
+
##
|
249
|
+
# Provide a detailed, user friendly representation
|
250
|
+
def inspect
|
251
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
252
|
+
"#<Twilio.FlexApi.V1.InteractionChannelContext #{context}>"
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
class InteractionChannelInstance < InstanceResource
|
257
|
+
##
|
258
|
+
# Initialize the InteractionChannelInstance
|
259
|
+
# @param [Version] version Version that contains the resource
|
260
|
+
# @param [Hash] payload payload that contains response from Twilio
|
261
|
+
# @param [String] interaction_sid The Interaction Sid for this channel.
|
262
|
+
# @param [String] sid The Channel Sid for this Participant.
|
263
|
+
# @return [InteractionChannelInstance] InteractionChannelInstance
|
264
|
+
def initialize(version, payload, interaction_sid: nil, sid: nil)
|
265
|
+
super(version)
|
266
|
+
|
267
|
+
# Marshaled Properties
|
268
|
+
@properties = {
|
269
|
+
'sid' => payload['sid'],
|
270
|
+
'interaction_sid' => payload['interaction_sid'],
|
271
|
+
'type' => payload['type'],
|
272
|
+
'url' => payload['url'],
|
273
|
+
'links' => payload['links'],
|
274
|
+
}
|
275
|
+
|
276
|
+
# Context
|
277
|
+
@instance_context = nil
|
278
|
+
@params = {'interaction_sid' => interaction_sid, 'sid' => sid || @properties['sid'], }
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# Generate an instance context for the instance, the context is capable of
|
283
|
+
# performing various actions. All instance actions are proxied to the context
|
284
|
+
# @return [InteractionChannelContext] InteractionChannelContext for this InteractionChannelInstance
|
285
|
+
def context
|
286
|
+
unless @instance_context
|
287
|
+
@instance_context = InteractionChannelContext.new(
|
288
|
+
@version,
|
289
|
+
@params['interaction_sid'],
|
290
|
+
@params['sid'],
|
291
|
+
)
|
292
|
+
end
|
293
|
+
@instance_context
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [String] The unique string that identifies the resource
|
298
|
+
def sid
|
299
|
+
@properties['sid']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [String] The Interaction Sid for this channel.
|
304
|
+
def interaction_sid
|
305
|
+
@properties['interaction_sid']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [interaction_channel.Type] The Interaction Channel's type.
|
310
|
+
def type
|
311
|
+
@properties['type']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [String] The url
|
316
|
+
def url
|
317
|
+
@properties['url']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [String] The links
|
322
|
+
def links
|
323
|
+
@properties['links']
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# Fetch the InteractionChannelInstance
|
328
|
+
# @return [InteractionChannelInstance] Fetched InteractionChannelInstance
|
329
|
+
def fetch
|
330
|
+
context.fetch
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Update the InteractionChannelInstance
|
335
|
+
# @param [interaction_channel.Status] status The Interaction Channel's status. Can
|
336
|
+
# be: `closed` or `wrapup`.
|
337
|
+
# @param [Hash] routing The Interaction Channel's routing parameters. Optional,
|
338
|
+
# may contain `status` to set the agent's Reservation state to either `closed` or
|
339
|
+
# `wrapup`. Default is `wrapup` if unspecified.
|
340
|
+
# @return [InteractionChannelInstance] Updated InteractionChannelInstance
|
341
|
+
def update(status: nil, routing: :unset)
|
342
|
+
context.update(status: status, routing: routing, )
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# Access the invites
|
347
|
+
# @return [invites] invites
|
348
|
+
def invites
|
349
|
+
context.invites
|
350
|
+
end
|
351
|
+
|
352
|
+
##
|
353
|
+
# Access the participants
|
354
|
+
# @return [participants] participants
|
355
|
+
def participants
|
356
|
+
context.participants
|
357
|
+
end
|
358
|
+
|
359
|
+
##
|
360
|
+
# Provide a user friendly representation
|
361
|
+
def to_s
|
362
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
363
|
+
"<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
|
364
|
+
end
|
365
|
+
|
366
|
+
##
|
367
|
+
# Provide a detailed, user friendly representation
|
368
|
+
def inspect
|
369
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
370
|
+
"<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>"
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
@@ -0,0 +1,233 @@
|
|
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 FlexApi < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class InteractionList < ListResource
|
14
|
+
##
|
15
|
+
# Initialize the InteractionList
|
16
|
+
# @param [Version] version Version that contains the resource
|
17
|
+
# @return [InteractionList] InteractionList
|
18
|
+
def initialize(version)
|
19
|
+
super(version)
|
20
|
+
|
21
|
+
# Path Solution
|
22
|
+
@solution = {}
|
23
|
+
@uri = "/Interactions"
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Create the InteractionInstance
|
28
|
+
# @param [Hash] channel The Interaction's channel.
|
29
|
+
# @param [Hash] routing The Interaction's routing logic.
|
30
|
+
# @return [InteractionInstance] Created InteractionInstance
|
31
|
+
def create(channel: nil, routing: nil)
|
32
|
+
data = Twilio::Values.of({
|
33
|
+
'Channel' => Twilio.serialize_object(channel),
|
34
|
+
'Routing' => Twilio.serialize_object(routing),
|
35
|
+
})
|
36
|
+
|
37
|
+
payload = @version.create('POST', @uri, data: data)
|
38
|
+
|
39
|
+
InteractionInstance.new(@version, payload, )
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Provide a user friendly representation
|
44
|
+
def to_s
|
45
|
+
'#<Twilio.FlexApi.V1.InteractionList>'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class InteractionPage < Page
|
50
|
+
##
|
51
|
+
# Initialize the InteractionPage
|
52
|
+
# @param [Version] version Version that contains the resource
|
53
|
+
# @param [Response] response Response from the API
|
54
|
+
# @param [Hash] solution Path solution for the resource
|
55
|
+
# @return [InteractionPage] InteractionPage
|
56
|
+
def initialize(version, response, solution)
|
57
|
+
super(version, response)
|
58
|
+
|
59
|
+
# Path Solution
|
60
|
+
@solution = solution
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Build an instance of InteractionInstance
|
65
|
+
# @param [Hash] payload Payload response from the API
|
66
|
+
# @return [InteractionInstance] InteractionInstance
|
67
|
+
def get_instance(payload)
|
68
|
+
InteractionInstance.new(@version, payload, )
|
69
|
+
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# Provide a user friendly representation
|
73
|
+
def to_s
|
74
|
+
'<Twilio.FlexApi.V1.InteractionPage>'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class InteractionContext < InstanceContext
|
79
|
+
##
|
80
|
+
# Initialize the InteractionContext
|
81
|
+
# @param [Version] version Version that contains the resource
|
82
|
+
# @param [String] sid The SID of the Interaction resource to fetch.
|
83
|
+
# @return [InteractionContext] InteractionContext
|
84
|
+
def initialize(version, sid)
|
85
|
+
super(version)
|
86
|
+
|
87
|
+
# Path Solution
|
88
|
+
@solution = {sid: sid, }
|
89
|
+
@uri = "/Interactions/#{@solution[:sid]}"
|
90
|
+
|
91
|
+
# Dependents
|
92
|
+
@channels = nil
|
93
|
+
end
|
94
|
+
|
95
|
+
##
|
96
|
+
# Fetch the InteractionInstance
|
97
|
+
# @return [InteractionInstance] Fetched InteractionInstance
|
98
|
+
def fetch
|
99
|
+
payload = @version.fetch('GET', @uri)
|
100
|
+
|
101
|
+
InteractionInstance.new(@version, payload, sid: @solution[:sid], )
|
102
|
+
end
|
103
|
+
|
104
|
+
##
|
105
|
+
# Access the channels
|
106
|
+
# @return [InteractionChannelList]
|
107
|
+
# @return [InteractionChannelContext] if sid was passed.
|
108
|
+
def channels(sid=:unset)
|
109
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
110
|
+
|
111
|
+
if sid != :unset
|
112
|
+
return InteractionChannelContext.new(@version, @solution[:sid], sid, )
|
113
|
+
end
|
114
|
+
|
115
|
+
unless @channels
|
116
|
+
@channels = InteractionChannelList.new(@version, interaction_sid: @solution[:sid], )
|
117
|
+
end
|
118
|
+
|
119
|
+
@channels
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Provide a user friendly representation
|
124
|
+
def to_s
|
125
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
126
|
+
"#<Twilio.FlexApi.V1.InteractionContext #{context}>"
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Provide a detailed, user friendly representation
|
131
|
+
def inspect
|
132
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
133
|
+
"#<Twilio.FlexApi.V1.InteractionContext #{context}>"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
class InteractionInstance < InstanceResource
|
138
|
+
##
|
139
|
+
# Initialize the InteractionInstance
|
140
|
+
# @param [Version] version Version that contains the resource
|
141
|
+
# @param [Hash] payload payload that contains response from Twilio
|
142
|
+
# @param [String] sid The SID of the Interaction resource to fetch.
|
143
|
+
# @return [InteractionInstance] InteractionInstance
|
144
|
+
def initialize(version, payload, sid: nil)
|
145
|
+
super(version)
|
146
|
+
|
147
|
+
# Marshaled Properties
|
148
|
+
@properties = {
|
149
|
+
'sid' => payload['sid'],
|
150
|
+
'channel' => payload['channel'],
|
151
|
+
'routing' => payload['routing'],
|
152
|
+
'url' => payload['url'],
|
153
|
+
'links' => payload['links'],
|
154
|
+
}
|
155
|
+
|
156
|
+
# Context
|
157
|
+
@instance_context = nil
|
158
|
+
@params = {'sid' => sid || @properties['sid'], }
|
159
|
+
end
|
160
|
+
|
161
|
+
##
|
162
|
+
# Generate an instance context for the instance, the context is capable of
|
163
|
+
# performing various actions. All instance actions are proxied to the context
|
164
|
+
# @return [InteractionContext] InteractionContext for this InteractionInstance
|
165
|
+
def context
|
166
|
+
unless @instance_context
|
167
|
+
@instance_context = InteractionContext.new(@version, @params['sid'], )
|
168
|
+
end
|
169
|
+
@instance_context
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# @return [String] The unique string that identifies the resource
|
174
|
+
def sid
|
175
|
+
@properties['sid']
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# @return [Hash] The Interaction's channel
|
180
|
+
def channel
|
181
|
+
@properties['channel']
|
182
|
+
end
|
183
|
+
|
184
|
+
##
|
185
|
+
# @return [Hash] The Interaction's routing logic
|
186
|
+
def routing
|
187
|
+
@properties['routing']
|
188
|
+
end
|
189
|
+
|
190
|
+
##
|
191
|
+
# @return [String] The url
|
192
|
+
def url
|
193
|
+
@properties['url']
|
194
|
+
end
|
195
|
+
|
196
|
+
##
|
197
|
+
# @return [String] The links
|
198
|
+
def links
|
199
|
+
@properties['links']
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Fetch the InteractionInstance
|
204
|
+
# @return [InteractionInstance] Fetched InteractionInstance
|
205
|
+
def fetch
|
206
|
+
context.fetch
|
207
|
+
end
|
208
|
+
|
209
|
+
##
|
210
|
+
# Access the channels
|
211
|
+
# @return [channels] channels
|
212
|
+
def channels
|
213
|
+
context.channels
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# Provide a user friendly representation
|
218
|
+
def to_s
|
219
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
220
|
+
"<Twilio.FlexApi.V1.InteractionInstance #{values}>"
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# Provide a detailed, user friendly representation
|
225
|
+
def inspect
|
226
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
227
|
+
"<Twilio.FlexApi.V1.InteractionInstance #{values}>"
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -18,6 +18,7 @@ module Twilio
|
|
18
18
|
@channel = nil
|
19
19
|
@configuration = nil
|
20
20
|
@flex_flow = nil
|
21
|
+
@interaction = nil
|
21
22
|
@web_channel = nil
|
22
23
|
end
|
23
24
|
|
@@ -57,6 +58,21 @@ module Twilio
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
61
|
+
##
|
62
|
+
# @param [String] sid The SID of the Interaction resource to fetch.
|
63
|
+
# @return [Twilio::REST::Flex_api::V1::InteractionContext] if sid was passed.
|
64
|
+
# @return [Twilio::REST::Flex_api::V1::InteractionList]
|
65
|
+
def interaction(sid=:unset)
|
66
|
+
if sid.nil?
|
67
|
+
raise ArgumentError, 'sid cannot be nil'
|
68
|
+
end
|
69
|
+
if sid == :unset
|
70
|
+
@interaction ||= InteractionList.new self
|
71
|
+
else
|
72
|
+
InteractionContext.new(self, sid)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
60
76
|
##
|
61
77
|
# @param [String] sid The SID of the WebChannel resource to fetch.
|
62
78
|
# @return [Twilio::REST::Flex_api::V1::WebChannelContext] if sid was passed.
|
@@ -52,6 +52,15 @@ module Twilio
|
|
52
52
|
self.v1.flex_flow(sid)
|
53
53
|
end
|
54
54
|
|
55
|
+
##
|
56
|
+
# @param [String] sid The unique string created by Twilio to identify an
|
57
|
+
# Interaction resource.
|
58
|
+
# @return [Twilio::REST::Flex_api::V1::InteractionInstance] if sid was passed.
|
59
|
+
# @return [Twilio::REST::Flex_api::V1::InteractionList]
|
60
|
+
def interaction(sid=:unset)
|
61
|
+
self.v1.interaction(sid)
|
62
|
+
end
|
63
|
+
|
55
64
|
##
|
56
65
|
# @param [String] sid The unique string that we created to identify the WebChannel
|
57
66
|
# resource.
|