twilio-ruby 5.6.1 → 5.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +18 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/preview/studio/flow/engagement.rb +0 -14
- data/lib/twilio-ruby/rest/studio.rb +44 -0
- data/lib/twilio-ruby/rest/studio/v1.rb +41 -0
- data/lib/twilio-ruby/rest/studio/v1/flow.rb +346 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement.rb +370 -0
- data/lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb +348 -0
- data/lib/twilio-ruby/rest/video.rb +8 -0
- data/lib/twilio-ruby/rest/video/v1.rb +15 -0
- data/lib/twilio-ruby/rest/video/v1/composition.rb +425 -0
- data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +24 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribed_track.rb +311 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/preview/studio/flow/engagement_spec.rb +0 -28
- data/spec/integration/studio/v1/flow/engagement/step_spec.rb +96 -0
- data/spec/integration/studio/v1/flow/engagement_spec.rb +143 -0
- data/spec/integration/studio/v1/flow_spec.rb +114 -0
- data/spec/integration/video/v1/composition_spec.rb +223 -0
- data/spec/integration/video/v1/recording_spec.rb +2 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribed_track_spec.rb +132 -0
- data/spec/integration/video/v1/room/room_participant_spec.rb +6 -3
- metadata +19 -2
@@ -0,0 +1,370 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Studio < Domain
|
10
|
+
class V1 < Version
|
11
|
+
class FlowContext < InstanceContext
|
12
|
+
##
|
13
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
14
|
+
class EngagementList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the EngagementList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] flow_sid The flow_sid
|
19
|
+
# @return [EngagementList] EngagementList
|
20
|
+
def initialize(version, flow_sid: nil)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {flow_sid: flow_sid}
|
25
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Lists EngagementInstance 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 EngagementInstance 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 EngagementInstance 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 EngagementInstance 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 EngagementInstance
|
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
|
+
response = @version.page(
|
90
|
+
'GET',
|
91
|
+
@uri,
|
92
|
+
params
|
93
|
+
)
|
94
|
+
EngagementPage.new(@version, response, @solution)
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# Retrieve a single page of EngagementInstance records from the API.
|
99
|
+
# Request is executed immediately.
|
100
|
+
# @param [String] target_url API-generated URL for the requested results page
|
101
|
+
# @return [Page] Page of EngagementInstance
|
102
|
+
def get_page(target_url)
|
103
|
+
response = @version.domain.request(
|
104
|
+
'GET',
|
105
|
+
target_url
|
106
|
+
)
|
107
|
+
EngagementPage.new(@version, response, @solution)
|
108
|
+
end
|
109
|
+
|
110
|
+
##
|
111
|
+
# Retrieve a single page of EngagementInstance records from the API.
|
112
|
+
# Request is executed immediately.
|
113
|
+
# @param [String] to The to
|
114
|
+
# @param [String] from The from
|
115
|
+
# @param [String] parameters The parameters
|
116
|
+
# @return [EngagementInstance] Newly created EngagementInstance
|
117
|
+
def create(to: nil, from: nil, parameters: :unset)
|
118
|
+
data = Twilio::Values.of({'To' => to, 'From' => from, 'Parameters' => parameters, })
|
119
|
+
|
120
|
+
payload = @version.create(
|
121
|
+
'POST',
|
122
|
+
@uri,
|
123
|
+
data: data
|
124
|
+
)
|
125
|
+
|
126
|
+
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Provide a user friendly representation
|
131
|
+
def to_s
|
132
|
+
'#<Twilio.Studio.V1.EngagementList>'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
138
|
+
class EngagementPage < Page
|
139
|
+
##
|
140
|
+
# Initialize the EngagementPage
|
141
|
+
# @param [Version] version Version that contains the resource
|
142
|
+
# @param [Response] response Response from the API
|
143
|
+
# @param [Hash] solution Path solution for the resource
|
144
|
+
# @return [EngagementPage] EngagementPage
|
145
|
+
def initialize(version, response, solution)
|
146
|
+
super(version, response)
|
147
|
+
|
148
|
+
# Path Solution
|
149
|
+
@solution = solution
|
150
|
+
end
|
151
|
+
|
152
|
+
##
|
153
|
+
# Build an instance of EngagementInstance
|
154
|
+
# @param [Hash] payload Payload response from the API
|
155
|
+
# @return [EngagementInstance] EngagementInstance
|
156
|
+
def get_instance(payload)
|
157
|
+
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Provide a user friendly representation
|
162
|
+
def to_s
|
163
|
+
'<Twilio.Studio.V1.EngagementPage>'
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
169
|
+
class EngagementContext < InstanceContext
|
170
|
+
##
|
171
|
+
# Initialize the EngagementContext
|
172
|
+
# @param [Version] version Version that contains the resource
|
173
|
+
# @param [String] flow_sid The flow_sid
|
174
|
+
# @param [String] sid The sid
|
175
|
+
# @return [EngagementContext] EngagementContext
|
176
|
+
def initialize(version, flow_sid, sid)
|
177
|
+
super(version)
|
178
|
+
|
179
|
+
# Path Solution
|
180
|
+
@solution = {flow_sid: flow_sid, sid: sid, }
|
181
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:sid]}"
|
182
|
+
|
183
|
+
# Dependents
|
184
|
+
@steps = nil
|
185
|
+
end
|
186
|
+
|
187
|
+
##
|
188
|
+
# Fetch a EngagementInstance
|
189
|
+
# @return [EngagementInstance] Fetched EngagementInstance
|
190
|
+
def fetch
|
191
|
+
params = Twilio::Values.of({})
|
192
|
+
|
193
|
+
payload = @version.fetch(
|
194
|
+
'GET',
|
195
|
+
@uri,
|
196
|
+
params,
|
197
|
+
)
|
198
|
+
|
199
|
+
EngagementInstance.new(@version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], )
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# Access the steps
|
204
|
+
# @return [StepList]
|
205
|
+
# @return [StepContext] if sid was passed.
|
206
|
+
def steps(sid=:unset)
|
207
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
208
|
+
|
209
|
+
if sid != :unset
|
210
|
+
return StepContext.new(@version, @solution[:flow_sid], @solution[:sid], sid, )
|
211
|
+
end
|
212
|
+
|
213
|
+
unless @steps
|
214
|
+
@steps = StepList.new(@version, flow_sid: @solution[:flow_sid], engagement_sid: @solution[:sid], )
|
215
|
+
end
|
216
|
+
|
217
|
+
@steps
|
218
|
+
end
|
219
|
+
|
220
|
+
##
|
221
|
+
# Provide a user friendly representation
|
222
|
+
def to_s
|
223
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
224
|
+
"#<Twilio.Studio.V1.EngagementContext #{context}>"
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
##
|
229
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
230
|
+
class EngagementInstance < InstanceResource
|
231
|
+
##
|
232
|
+
# Initialize the EngagementInstance
|
233
|
+
# @param [Version] version Version that contains the resource
|
234
|
+
# @param [Hash] payload payload that contains response from Twilio
|
235
|
+
# @param [String] flow_sid The flow_sid
|
236
|
+
# @param [String] sid The sid
|
237
|
+
# @return [EngagementInstance] EngagementInstance
|
238
|
+
def initialize(version, payload, flow_sid: nil, sid: nil)
|
239
|
+
super(version)
|
240
|
+
|
241
|
+
# Marshaled Properties
|
242
|
+
@properties = {
|
243
|
+
'sid' => payload['sid'],
|
244
|
+
'account_sid' => payload['account_sid'],
|
245
|
+
'flow_sid' => payload['flow_sid'],
|
246
|
+
'contact_sid' => payload['contact_sid'],
|
247
|
+
'contact_channel_address' => payload['contact_channel_address'],
|
248
|
+
'status' => payload['status'],
|
249
|
+
'context' => payload['context'],
|
250
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
251
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
252
|
+
'url' => payload['url'],
|
253
|
+
'links' => payload['links'],
|
254
|
+
}
|
255
|
+
|
256
|
+
# Context
|
257
|
+
@instance_context = nil
|
258
|
+
@params = {'flow_sid' => flow_sid, 'sid' => sid || @properties['sid'], }
|
259
|
+
end
|
260
|
+
|
261
|
+
##
|
262
|
+
# Generate an instance context for the instance, the context is capable of
|
263
|
+
# performing various actions. All instance actions are proxied to the context
|
264
|
+
# @return [EngagementContext] EngagementContext for this EngagementInstance
|
265
|
+
def context
|
266
|
+
unless @instance_context
|
267
|
+
@instance_context = EngagementContext.new(@version, @params['flow_sid'], @params['sid'], )
|
268
|
+
end
|
269
|
+
@instance_context
|
270
|
+
end
|
271
|
+
|
272
|
+
##
|
273
|
+
# @return [String] The sid
|
274
|
+
def sid
|
275
|
+
@properties['sid']
|
276
|
+
end
|
277
|
+
|
278
|
+
##
|
279
|
+
# @return [String] The account_sid
|
280
|
+
def account_sid
|
281
|
+
@properties['account_sid']
|
282
|
+
end
|
283
|
+
|
284
|
+
##
|
285
|
+
# @return [String] The flow_sid
|
286
|
+
def flow_sid
|
287
|
+
@properties['flow_sid']
|
288
|
+
end
|
289
|
+
|
290
|
+
##
|
291
|
+
# @return [String] The contact_sid
|
292
|
+
def contact_sid
|
293
|
+
@properties['contact_sid']
|
294
|
+
end
|
295
|
+
|
296
|
+
##
|
297
|
+
# @return [String] The contact_channel_address
|
298
|
+
def contact_channel_address
|
299
|
+
@properties['contact_channel_address']
|
300
|
+
end
|
301
|
+
|
302
|
+
##
|
303
|
+
# @return [engagement.Status] The status
|
304
|
+
def status
|
305
|
+
@properties['status']
|
306
|
+
end
|
307
|
+
|
308
|
+
##
|
309
|
+
# @return [Hash] The context
|
310
|
+
def context
|
311
|
+
@properties['context']
|
312
|
+
end
|
313
|
+
|
314
|
+
##
|
315
|
+
# @return [Time] The date_created
|
316
|
+
def date_created
|
317
|
+
@properties['date_created']
|
318
|
+
end
|
319
|
+
|
320
|
+
##
|
321
|
+
# @return [Time] The date_updated
|
322
|
+
def date_updated
|
323
|
+
@properties['date_updated']
|
324
|
+
end
|
325
|
+
|
326
|
+
##
|
327
|
+
# @return [String] The url
|
328
|
+
def url
|
329
|
+
@properties['url']
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# @return [String] The links
|
334
|
+
def links
|
335
|
+
@properties['links']
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# Fetch a EngagementInstance
|
340
|
+
# @return [EngagementInstance] Fetched EngagementInstance
|
341
|
+
def fetch
|
342
|
+
context.fetch
|
343
|
+
end
|
344
|
+
|
345
|
+
##
|
346
|
+
# Access the steps
|
347
|
+
# @return [steps] steps
|
348
|
+
def steps
|
349
|
+
context.steps
|
350
|
+
end
|
351
|
+
|
352
|
+
##
|
353
|
+
# Provide a user friendly representation
|
354
|
+
def to_s
|
355
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
356
|
+
"<Twilio.Studio.V1.EngagementInstance #{values}>"
|
357
|
+
end
|
358
|
+
|
359
|
+
##
|
360
|
+
# Provide a detailed, user friendly representation
|
361
|
+
def inspect
|
362
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
363
|
+
"<Twilio.Studio.V1.EngagementInstance #{values}>"
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
@@ -0,0 +1,348 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Studio < Domain
|
10
|
+
class V1 < Version
|
11
|
+
class FlowContext < InstanceContext
|
12
|
+
class EngagementContext < InstanceContext
|
13
|
+
##
|
14
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
15
|
+
class StepList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the StepList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @param [String] flow_sid The flow_sid
|
20
|
+
# @param [String] engagement_sid The engagement_sid
|
21
|
+
# @return [StepList] StepList
|
22
|
+
def initialize(version, flow_sid: nil, engagement_sid: nil)
|
23
|
+
super(version)
|
24
|
+
|
25
|
+
# Path Solution
|
26
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid}
|
27
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:engagement_sid]}/Steps"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Lists StepInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
|
35
|
+
# guarantees to never return more than limit. Default is no limit
|
36
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
37
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
38
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
39
|
+
# efficient page size, i.e. min(limit, 1000)
|
40
|
+
# @return [Array] Array of up to limit results
|
41
|
+
def list(limit: nil, page_size: nil)
|
42
|
+
self.stream(limit: limit, page_size: page_size).entries
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Streams StepInstance records from the API as an Enumerable.
|
47
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
48
|
+
# is reached.
|
49
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
50
|
+
# guarantees to never return more than limit. Default is no limit.
|
51
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
52
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
53
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
54
|
+
# efficient page size, i.e. min(limit, 1000)
|
55
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
56
|
+
def stream(limit: nil, page_size: nil)
|
57
|
+
limits = @version.read_limits(limit, page_size)
|
58
|
+
|
59
|
+
page = self.page(page_size: limits[:page_size], )
|
60
|
+
|
61
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
62
|
+
end
|
63
|
+
|
64
|
+
##
|
65
|
+
# When passed a block, yields StepInstance records from the API.
|
66
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
67
|
+
# is reached.
|
68
|
+
def each
|
69
|
+
limits = @version.read_limits
|
70
|
+
|
71
|
+
page = self.page(page_size: limits[:page_size], )
|
72
|
+
|
73
|
+
@version.stream(page,
|
74
|
+
limit: limits[:limit],
|
75
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Retrieve a single page of StepInstance records from the API.
|
80
|
+
# Request is executed immediately.
|
81
|
+
# @param [String] page_token PageToken provided by the API
|
82
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
83
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
84
|
+
# @return [Page] Page of StepInstance
|
85
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
86
|
+
params = Twilio::Values.of({
|
87
|
+
'PageToken' => page_token,
|
88
|
+
'Page' => page_number,
|
89
|
+
'PageSize' => page_size,
|
90
|
+
})
|
91
|
+
response = @version.page(
|
92
|
+
'GET',
|
93
|
+
@uri,
|
94
|
+
params
|
95
|
+
)
|
96
|
+
StepPage.new(@version, response, @solution)
|
97
|
+
end
|
98
|
+
|
99
|
+
##
|
100
|
+
# Retrieve a single page of StepInstance records from the API.
|
101
|
+
# Request is executed immediately.
|
102
|
+
# @param [String] target_url API-generated URL for the requested results page
|
103
|
+
# @return [Page] Page of StepInstance
|
104
|
+
def get_page(target_url)
|
105
|
+
response = @version.domain.request(
|
106
|
+
'GET',
|
107
|
+
target_url
|
108
|
+
)
|
109
|
+
StepPage.new(@version, response, @solution)
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Provide a user friendly representation
|
114
|
+
def to_s
|
115
|
+
'#<Twilio.Studio.V1.StepList>'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
121
|
+
class StepPage < Page
|
122
|
+
##
|
123
|
+
# Initialize the StepPage
|
124
|
+
# @param [Version] version Version that contains the resource
|
125
|
+
# @param [Response] response Response from the API
|
126
|
+
# @param [Hash] solution Path solution for the resource
|
127
|
+
# @return [StepPage] StepPage
|
128
|
+
def initialize(version, response, solution)
|
129
|
+
super(version, response)
|
130
|
+
|
131
|
+
# Path Solution
|
132
|
+
@solution = solution
|
133
|
+
end
|
134
|
+
|
135
|
+
##
|
136
|
+
# Build an instance of StepInstance
|
137
|
+
# @param [Hash] payload Payload response from the API
|
138
|
+
# @return [StepInstance] StepInstance
|
139
|
+
def get_instance(payload)
|
140
|
+
StepInstance.new(
|
141
|
+
@version,
|
142
|
+
payload,
|
143
|
+
flow_sid: @solution[:flow_sid],
|
144
|
+
engagement_sid: @solution[:engagement_sid],
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Provide a user friendly representation
|
150
|
+
def to_s
|
151
|
+
'<Twilio.Studio.V1.StepPage>'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
##
|
156
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
157
|
+
class StepContext < InstanceContext
|
158
|
+
##
|
159
|
+
# Initialize the StepContext
|
160
|
+
# @param [Version] version Version that contains the resource
|
161
|
+
# @param [String] flow_sid The flow_sid
|
162
|
+
# @param [String] engagement_sid The engagement_sid
|
163
|
+
# @param [String] sid The sid
|
164
|
+
# @return [StepContext] StepContext
|
165
|
+
def initialize(version, flow_sid, engagement_sid, sid)
|
166
|
+
super(version)
|
167
|
+
|
168
|
+
# Path Solution
|
169
|
+
@solution = {flow_sid: flow_sid, engagement_sid: engagement_sid, sid: sid, }
|
170
|
+
@uri = "/Flows/#{@solution[:flow_sid]}/Engagements/#{@solution[:engagement_sid]}/Steps/#{@solution[:sid]}"
|
171
|
+
end
|
172
|
+
|
173
|
+
##
|
174
|
+
# Fetch a StepInstance
|
175
|
+
# @return [StepInstance] Fetched StepInstance
|
176
|
+
def fetch
|
177
|
+
params = Twilio::Values.of({})
|
178
|
+
|
179
|
+
payload = @version.fetch(
|
180
|
+
'GET',
|
181
|
+
@uri,
|
182
|
+
params,
|
183
|
+
)
|
184
|
+
|
185
|
+
StepInstance.new(
|
186
|
+
@version,
|
187
|
+
payload,
|
188
|
+
flow_sid: @solution[:flow_sid],
|
189
|
+
engagement_sid: @solution[:engagement_sid],
|
190
|
+
sid: @solution[:sid],
|
191
|
+
)
|
192
|
+
end
|
193
|
+
|
194
|
+
##
|
195
|
+
# Provide a user friendly representation
|
196
|
+
def to_s
|
197
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
198
|
+
"#<Twilio.Studio.V1.StepContext #{context}>"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
##
|
203
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
204
|
+
class StepInstance < InstanceResource
|
205
|
+
##
|
206
|
+
# Initialize the StepInstance
|
207
|
+
# @param [Version] version Version that contains the resource
|
208
|
+
# @param [Hash] payload payload that contains response from Twilio
|
209
|
+
# @param [String] flow_sid The flow_sid
|
210
|
+
# @param [String] engagement_sid The engagement_sid
|
211
|
+
# @param [String] sid The sid
|
212
|
+
# @return [StepInstance] StepInstance
|
213
|
+
def initialize(version, payload, flow_sid: nil, engagement_sid: nil, sid: nil)
|
214
|
+
super(version)
|
215
|
+
|
216
|
+
# Marshaled Properties
|
217
|
+
@properties = {
|
218
|
+
'sid' => payload['sid'],
|
219
|
+
'account_sid' => payload['account_sid'],
|
220
|
+
'flow_sid' => payload['flow_sid'],
|
221
|
+
'engagement_sid' => payload['engagement_sid'],
|
222
|
+
'name' => payload['name'],
|
223
|
+
'context' => payload['context'],
|
224
|
+
'transitioned_from' => payload['transitioned_from'],
|
225
|
+
'transitioned_to' => payload['transitioned_to'],
|
226
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
227
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
228
|
+
'url' => payload['url'],
|
229
|
+
}
|
230
|
+
|
231
|
+
# Context
|
232
|
+
@instance_context = nil
|
233
|
+
@params = {
|
234
|
+
'flow_sid' => flow_sid,
|
235
|
+
'engagement_sid' => engagement_sid,
|
236
|
+
'sid' => sid || @properties['sid'],
|
237
|
+
}
|
238
|
+
end
|
239
|
+
|
240
|
+
##
|
241
|
+
# Generate an instance context for the instance, the context is capable of
|
242
|
+
# performing various actions. All instance actions are proxied to the context
|
243
|
+
# @return [StepContext] StepContext for this StepInstance
|
244
|
+
def context
|
245
|
+
unless @instance_context
|
246
|
+
@instance_context = StepContext.new(
|
247
|
+
@version,
|
248
|
+
@params['flow_sid'],
|
249
|
+
@params['engagement_sid'],
|
250
|
+
@params['sid'],
|
251
|
+
)
|
252
|
+
end
|
253
|
+
@instance_context
|
254
|
+
end
|
255
|
+
|
256
|
+
##
|
257
|
+
# @return [String] The sid
|
258
|
+
def sid
|
259
|
+
@properties['sid']
|
260
|
+
end
|
261
|
+
|
262
|
+
##
|
263
|
+
# @return [String] The account_sid
|
264
|
+
def account_sid
|
265
|
+
@properties['account_sid']
|
266
|
+
end
|
267
|
+
|
268
|
+
##
|
269
|
+
# @return [String] The flow_sid
|
270
|
+
def flow_sid
|
271
|
+
@properties['flow_sid']
|
272
|
+
end
|
273
|
+
|
274
|
+
##
|
275
|
+
# @return [String] The engagement_sid
|
276
|
+
def engagement_sid
|
277
|
+
@properties['engagement_sid']
|
278
|
+
end
|
279
|
+
|
280
|
+
##
|
281
|
+
# @return [String] The name
|
282
|
+
def name
|
283
|
+
@properties['name']
|
284
|
+
end
|
285
|
+
|
286
|
+
##
|
287
|
+
# @return [Hash] The context
|
288
|
+
def context
|
289
|
+
@properties['context']
|
290
|
+
end
|
291
|
+
|
292
|
+
##
|
293
|
+
# @return [String] The transitioned_from
|
294
|
+
def transitioned_from
|
295
|
+
@properties['transitioned_from']
|
296
|
+
end
|
297
|
+
|
298
|
+
##
|
299
|
+
# @return [String] The transitioned_to
|
300
|
+
def transitioned_to
|
301
|
+
@properties['transitioned_to']
|
302
|
+
end
|
303
|
+
|
304
|
+
##
|
305
|
+
# @return [Time] The date_created
|
306
|
+
def date_created
|
307
|
+
@properties['date_created']
|
308
|
+
end
|
309
|
+
|
310
|
+
##
|
311
|
+
# @return [Time] The date_updated
|
312
|
+
def date_updated
|
313
|
+
@properties['date_updated']
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# @return [String] The url
|
318
|
+
def url
|
319
|
+
@properties['url']
|
320
|
+
end
|
321
|
+
|
322
|
+
##
|
323
|
+
# Fetch a StepInstance
|
324
|
+
# @return [StepInstance] Fetched StepInstance
|
325
|
+
def fetch
|
326
|
+
context.fetch
|
327
|
+
end
|
328
|
+
|
329
|
+
##
|
330
|
+
# Provide a user friendly representation
|
331
|
+
def to_s
|
332
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
333
|
+
"<Twilio.Studio.V1.StepInstance #{values}>"
|
334
|
+
end
|
335
|
+
|
336
|
+
##
|
337
|
+
# Provide a detailed, user friendly representation
|
338
|
+
def inspect
|
339
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
340
|
+
"<Twilio.Studio.V1.StepInstance #{values}>"
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|