twilio-ruby 5.10.6 → 5.10.7

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