twilio-ruby 5.10.6 → 5.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d8915509528831b439fb45ef8cb25d10790bebe
4
- data.tar.gz: 54eb53c3d93bf543d7458ddc163fa504f9cc2f5a
3
+ metadata.gz: da9f21f9decc5e739bf2e9d6e459f86e2d4e4ead
4
+ data.tar.gz: 3e167ee387f6cb92a862f752bc90b00570e16935
5
5
  SHA512:
6
- metadata.gz: 7657be54da4eaa33d4e81ccc580d1499e73dcc20e1bb27b5b01d367553aeb97f20e8b8c2cb0e6043209749b80ada1c15aea9cba8c3c71cf1052f939aca288d36
7
- data.tar.gz: 54af734a54bd1118bbeacd9d19cfe2ef407bf9897b127053a13a22f444e73cfd7e4a1d9217ab3c51333a9d4c2fddd0843b9f8f30b9a47a889fb3b2dc0022b369
6
+ metadata.gz: 65f05038a1226db7b0ed1b950242ed8e4e7d6614cbc258ce840c7866a721471f6fc4c4b589d1097f266a9895ba18f6c929d61fc683923148ebebdd21a6b7e2b2
7
+ data.tar.gz: f3ab0edfa7891346ef7cebf162f05c19dd9d11d64172aa272ea8f1bc73ccba5192eb14db835be9dfa246fedb040f983635bb95dd8ab91c279754f699c56424e2
data/CHANGES.md CHANGED
@@ -1,6 +1,18 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2018-07-11] Version 5.10.7
5
+ ----------------------------
6
+ **Api**
7
+ - Add `cidr_prefix_length` param to SIP IpAddresses API
8
+
9
+ **Studio**
10
+ - Add new /Execution endpoints to begin Engagement -> Execution migration
11
+
12
+ **Video**
13
+ - [Rooms] Allow deletion of individual recordings from a room
14
+
15
+
4
16
  [2018-07-05] Version 5.10.6
5
17
  ----------------------------
6
18
  **Library**
data/README.md CHANGED
@@ -27,13 +27,13 @@ in-line code documentation here in the library.
27
27
  To install using [Bundler][bundler] grab the latest stable version:
28
28
 
29
29
  ```ruby
30
- gem 'twilio-ruby', '~> 5.10.6'
30
+ gem 'twilio-ruby', '~> 5.10.7'
31
31
  ```
32
32
 
33
33
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
34
34
 
35
35
  ```bash
36
- gem install twilio-ruby -v 5.10.6
36
+ gem install twilio-ruby -v 5.10.7
37
37
  ```
38
38
 
39
39
  To build and install the development branch yourself from the latest source:
@@ -16,7 +16,7 @@ module Twilio
16
16
  # Initialize the RecordingList
17
17
  # @param [Version] version Version that contains the resource
18
18
  # @param [String] account_sid The unique ID of the
19
- # [Account](https://www.twilio.com/docs/api/rest/account) responsible for this
19
+ # [Account](https://www.twilio.com/docs/iam/api/account) responsible for this
20
20
  # recording.
21
21
  # @return [RecordingList] RecordingList
22
22
  def initialize(version, account_sid: nil)
@@ -34,8 +34,8 @@ module Twilio
34
34
  # @param [Time] date_created_before Filter by date created
35
35
  # @param [Time] date_created Filter by date created
36
36
  # @param [Time] date_created_after Filter by date created
37
- # @param [String] call_sid Only show recordings made during the call given by the
38
- # indicated sid
37
+ # @param [String] call_sid Only show recordings made during the call indicated by
38
+ # this call SID
39
39
  # @param [String] conference_sid The conference_sid
40
40
  # @param [Integer] limit Upper limit for the number of records to return. stream()
41
41
  # guarantees to never return more than limit. Default is no limit
@@ -63,8 +63,8 @@ module Twilio
63
63
  # @param [Time] date_created_before Filter by date created
64
64
  # @param [Time] date_created Filter by date created
65
65
  # @param [Time] date_created_after Filter by date created
66
- # @param [String] call_sid Only show recordings made during the call given by the
67
- # indicated sid
66
+ # @param [String] call_sid Only show recordings made during the call indicated by
67
+ # this call SID
68
68
  # @param [String] conference_sid The conference_sid
69
69
  # @param [Integer] limit Upper limit for the number of records to return. stream()
70
70
  # guarantees to never return more than limit. Default is no limit.
@@ -108,8 +108,8 @@ module Twilio
108
108
  # @param [Time] date_created_before Filter by date created
109
109
  # @param [Time] date_created Filter by date created
110
110
  # @param [Time] date_created_after Filter by date created
111
- # @param [String] call_sid Only show recordings made during the call given by the
112
- # indicated sid
111
+ # @param [String] call_sid Only show recordings made during the call indicated by
112
+ # this call SID
113
113
  # @param [String] conference_sid The conference_sid
114
114
  # @param [String] page_token PageToken provided by the API
115
115
  # @param [Integer] page_number Page Number, this value is simply for client state
@@ -188,7 +188,7 @@ module Twilio
188
188
  # Initialize the RecordingContext
189
189
  # @param [Version] version Version that contains the resource
190
190
  # @param [String] account_sid The account_sid
191
- # @param [String] sid The recording Sid that uniquely identifies this resource
191
+ # @param [String] sid The unique recording SID that identifies this resource
192
192
  # @return [RecordingContext] RecordingContext
193
193
  def initialize(version, account_sid, sid)
194
194
  super(version)
@@ -282,9 +282,9 @@ module Twilio
282
282
  # @param [Version] version Version that contains the resource
283
283
  # @param [Hash] payload payload that contains response from Twilio
284
284
  # @param [String] account_sid The unique ID of the
285
- # [Account](https://www.twilio.com/docs/api/rest/account) responsible for this
285
+ # [Account](https://www.twilio.com/docs/iam/api/account) responsible for this
286
286
  # recording.
287
- # @param [String] sid The recording Sid that uniquely identifies this resource
287
+ # @param [String] sid The unique recording SID that identifies this resource
288
288
  # @return [RecordingInstance] RecordingInstance
289
289
  def initialize(version, payload, account_sid: nil, sid: nil)
290
290
  super(version)
@@ -328,7 +328,7 @@ module Twilio
328
328
  end
329
329
 
330
330
  ##
331
- # @return [String] The unique sid that identifies this account
331
+ # @return [String] The unique SID that identifies this account
332
332
  def account_sid
333
333
  @properties['account_sid']
334
334
  end
@@ -340,13 +340,13 @@ module Twilio
340
340
  end
341
341
 
342
342
  ##
343
- # @return [String] The unique id for the call leg that corresponds to the recording.
343
+ # @return [String] The unique ID for the call leg that corresponds to the recording.
344
344
  def call_sid
345
345
  @properties['call_sid']
346
346
  end
347
347
 
348
348
  ##
349
- # @return [String] The unique id for the conference associated with the recording, if a conference recording.
349
+ # @return [String] The unique ID for the conference associated with the recording.
350
350
  def conference_sid
351
351
  @properties['conference_sid']
352
352
  end
@@ -364,13 +364,13 @@ module Twilio
364
364
  end
365
365
 
366
366
  ##
367
- # @return [Time] The start time of the recording, given in RFC 2822 format.
367
+ # @return [Time] The start time of the recording, in RFC 2822 format.
368
368
  def start_time
369
369
  @properties['start_time']
370
370
  end
371
371
 
372
372
  ##
373
- # @return [String] The length of the recording, in seconds.
373
+ # @return [String] The length of the recording in seconds.
374
374
  def duration
375
375
  @properties['duration']
376
376
  end
@@ -116,9 +116,14 @@ module Twilio
116
116
  # Request is executed immediately.
117
117
  # @param [String] friendly_name The friendly_name
118
118
  # @param [String] ip_address The ip_address
119
+ # @param [String] cidr_prefix_length The cidr_prefix_length
119
120
  # @return [IpAddressInstance] Newly created IpAddressInstance
120
- def create(friendly_name: nil, ip_address: nil)
121
- data = Twilio::Values.of({'FriendlyName' => friendly_name, 'IpAddress' => ip_address, })
121
+ def create(friendly_name: nil, ip_address: nil, cidr_prefix_length: :unset)
122
+ data = Twilio::Values.of({
123
+ 'FriendlyName' => friendly_name,
124
+ 'IpAddress' => ip_address,
125
+ 'CidrPrefixLength' => cidr_prefix_length,
126
+ })
122
127
 
123
128
  payload = @version.create(
124
129
  'POST',
@@ -220,9 +225,14 @@ module Twilio
220
225
  # Update the IpAddressInstance
221
226
  # @param [String] ip_address The ip_address
222
227
  # @param [String] friendly_name The friendly_name
228
+ # @param [String] cidr_prefix_length The cidr_prefix_length
223
229
  # @return [IpAddressInstance] Updated IpAddressInstance
224
- def update(ip_address: :unset, friendly_name: :unset)
225
- data = Twilio::Values.of({'IpAddress' => ip_address, 'FriendlyName' => friendly_name, })
230
+ def update(ip_address: :unset, friendly_name: :unset, cidr_prefix_length: :unset)
231
+ data = Twilio::Values.of({
232
+ 'IpAddress' => ip_address,
233
+ 'FriendlyName' => friendly_name,
234
+ 'CidrPrefixLength' => cidr_prefix_length,
235
+ })
226
236
 
227
237
  payload = @version.update(
228
238
  'POST',
@@ -273,6 +283,7 @@ module Twilio
273
283
  'account_sid' => payload['account_sid'],
274
284
  'friendly_name' => payload['friendly_name'],
275
285
  'ip_address' => payload['ip_address'],
286
+ 'cidr_prefix_length' => payload['cidr_prefix_length'].to_i,
276
287
  'ip_access_control_list_sid' => payload['ip_access_control_list_sid'],
277
288
  'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
278
289
  'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
@@ -328,6 +339,12 @@ module Twilio
328
339
  @properties['ip_address']
329
340
  end
330
341
 
342
+ ##
343
+ # @return [String] An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used.
344
+ def cidr_prefix_length
345
+ @properties['cidr_prefix_length']
346
+ end
347
+
331
348
  ##
332
349
  # @return [String] The ip_access_control_list_sid
333
350
  def ip_access_control_list_sid
@@ -363,9 +380,14 @@ module Twilio
363
380
  # Update the IpAddressInstance
364
381
  # @param [String] ip_address The ip_address
365
382
  # @param [String] friendly_name The friendly_name
383
+ # @param [String] cidr_prefix_length The cidr_prefix_length
366
384
  # @return [IpAddressInstance] Updated IpAddressInstance
367
- def update(ip_address: :unset, friendly_name: :unset)
368
- context.update(ip_address: ip_address, friendly_name: friendly_name, )
385
+ def update(ip_address: :unset, friendly_name: :unset, cidr_prefix_length: :unset)
386
+ context.update(
387
+ ip_address: ip_address,
388
+ friendly_name: friendly_name,
389
+ cidr_prefix_length: cidr_prefix_length,
390
+ )
369
391
  end
370
392
 
371
393
  ##
@@ -134,6 +134,14 @@ module Twilio
134
134
  self.hosted_numbers.hosted_number_orders(sid)
135
135
  end
136
136
 
137
+ ##
138
+ # @param [String] sid A 34 character string that uniquely identifies this Add-on.
139
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
140
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
141
+ def available_add_ons(sid=:unset)
142
+ self.marketplace.available_add_ons(sid)
143
+ end
144
+
137
145
  ##
138
146
  # @param [String] sid 34 character string that uniquely identifies the Add-on.
139
147
  # This Sid can also be found in the Console on that specific Add-ons page as the
@@ -144,14 +152,6 @@ module Twilio
144
152
  self.marketplace.installed_add_ons(sid)
145
153
  end
146
154
 
147
- ##
148
- # @param [String] sid A 34 character string that uniquely identifies this Add-on.
149
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
150
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
151
- def available_add_ons(sid=:unset)
152
- self.marketplace.available_add_ons(sid)
153
- end
154
-
155
155
  ##
156
156
  # @param [String] sid The sid
157
157
  # @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed.
@@ -137,14 +137,20 @@ module Twilio
137
137
  # Address resource that is associated with this AuthorizationDocument.
138
138
  # @param [String] email Email that this AuthorizationDocument will be sent to for
139
139
  # signing.
140
+ # @param [String] contact_title The title of the person authorized to sign the
141
+ # Authorization Document for this phone number.
142
+ # @param [String] contact_phone_number The contact phone number of the person
143
+ # authorized to sign the Authorization Document.
140
144
  # @param [String] cc_emails Email recipients who will be informed when an
141
145
  # Authorization Document has been sent and signed.
142
146
  # @return [AuthorizationDocumentInstance] Newly created AuthorizationDocumentInstance
143
- def create(hosted_number_order_sids: nil, address_sid: nil, email: nil, cc_emails: :unset)
147
+ def create(hosted_number_order_sids: nil, address_sid: nil, email: nil, contact_title: nil, contact_phone_number: nil, cc_emails: :unset)
144
148
  data = Twilio::Values.of({
145
149
  'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
146
150
  'AddressSid' => address_sid,
147
151
  'Email' => email,
152
+ 'ContactTitle' => contact_title,
153
+ 'ContactPhoneNumber' => contact_phone_number,
148
154
  'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
149
155
  })
150
156
 
@@ -245,14 +251,20 @@ module Twilio
245
251
  # can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5.
246
252
  # failed. See the section entitled [Status
247
253
  # Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses.
254
+ # @param [String] contact_title The title of the person authorized to sign the
255
+ # Authorization Document for this phone number.
256
+ # @param [String] contact_phone_number The contact phone number of the person
257
+ # authorized to sign the Authorization Document.
248
258
  # @return [AuthorizationDocumentInstance] Updated AuthorizationDocumentInstance
249
- def update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset)
259
+ def update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset, contact_title: :unset, contact_phone_number: :unset)
250
260
  data = Twilio::Values.of({
251
261
  'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
252
262
  'AddressSid' => address_sid,
253
263
  'Email' => email,
254
264
  'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
255
265
  'Status' => status,
266
+ 'ContactTitle' => contact_title,
267
+ 'ContactPhoneNumber' => contact_phone_number,
256
268
  })
257
269
 
258
270
  payload = @version.update(
@@ -405,14 +417,20 @@ module Twilio
405
417
  # can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5.
406
418
  # failed. See the section entitled [Status
407
419
  # Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses.
420
+ # @param [String] contact_title The title of the person authorized to sign the
421
+ # Authorization Document for this phone number.
422
+ # @param [String] contact_phone_number The contact phone number of the person
423
+ # authorized to sign the Authorization Document.
408
424
  # @return [AuthorizationDocumentInstance] Updated AuthorizationDocumentInstance
409
- def update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset)
425
+ def update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset, contact_title: :unset, contact_phone_number: :unset)
410
426
  context.update(
411
427
  hosted_number_order_sids: hosted_number_order_sids,
412
428
  address_sid: address_sid,
413
429
  email: email,
414
430
  cc_emails: cc_emails,
415
431
  status: status,
432
+ contact_title: contact_title,
433
+ contact_phone_number: contact_phone_number,
416
434
  )
417
435
  end
418
436
 
@@ -15,37 +15,37 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'marketplace'
18
- @installed_add_ons = nil
19
18
  @available_add_ons = nil
19
+ @installed_add_ons = nil
20
20
  end
21
21
 
22
22
  ##
23
- # @param [String] sid The Installed Add-on Sid that uniquely identifies this
23
+ # @param [String] sid The Available Add-on Sid that uniquely identifies this
24
24
  # resource
25
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
26
- # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
27
- def installed_add_ons(sid=:unset)
25
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
26
+ # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
27
+ def available_add_ons(sid=:unset)
28
28
  if sid.nil?
29
29
  raise ArgumentError, 'sid cannot be nil'
30
30
  elsif sid == :unset
31
- @installed_add_ons ||= InstalledAddOnList.new self
31
+ @available_add_ons ||= AvailableAddOnList.new self
32
32
  else
33
- InstalledAddOnContext.new(self, sid)
33
+ AvailableAddOnContext.new(self, sid)
34
34
  end
35
35
  end
36
36
 
37
37
  ##
38
- # @param [String] sid The Available Add-on Sid that uniquely identifies this
38
+ # @param [String] sid The Installed Add-on Sid that uniquely identifies this
39
39
  # resource
40
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnContext] if sid was passed.
41
- # @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
42
- def available_add_ons(sid=:unset)
40
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnContext] if sid was passed.
41
+ # @return [Twilio::REST::Preview::Marketplace::InstalledAddOnList]
42
+ def installed_add_ons(sid=:unset)
43
43
  if sid.nil?
44
44
  raise ArgumentError, 'sid cannot be nil'
45
45
  elsif sid == :unset
46
- @available_add_ons ||= AvailableAddOnList.new self
46
+ @installed_add_ons ||= InstalledAddOnList.new self
47
47
  else
48
- AvailableAddOnContext.new(self, sid)
48
+ InstalledAddOnContext.new(self, sid)
49
49
  end
50
50
  end
51
51
 
@@ -162,6 +162,7 @@ module Twilio
162
162
 
163
163
  # Dependents
164
164
  @engagements = nil
165
+ @executions = nil
165
166
  end
166
167
 
167
168
  ##
@@ -204,6 +205,24 @@ module Twilio
204
205
  @engagements
205
206
  end
206
207
 
208
+ ##
209
+ # Access the executions
210
+ # @return [ExecutionList]
211
+ # @return [ExecutionContext] if sid was passed.
212
+ def executions(sid=:unset)
213
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
214
+
215
+ if sid != :unset
216
+ return ExecutionContext.new(@version, @solution[:sid], sid, )
217
+ end
218
+
219
+ unless @executions
220
+ @executions = ExecutionList.new(@version, flow_sid: @solution[:sid], )
221
+ end
222
+
223
+ @executions
224
+ end
225
+
207
226
  ##
208
227
  # Provide a user friendly representation
209
228
  def to_s
@@ -328,6 +347,13 @@ module Twilio
328
347
  context.engagements
329
348
  end
330
349
 
350
+ ##
351
+ # Access the executions
352
+ # @return [executions] executions
353
+ def executions
354
+ context.executions
355
+ end
356
+
331
357
  ##
332
358
  # Provide a user friendly representation
333
359
  def to_s
@@ -0,0 +1,410 @@
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
+ ##
15
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
16
+ class ExecutionList < ListResource
17
+ ##
18
+ # Initialize the ExecutionList
19
+ # @param [Version] version Version that contains the resource
20
+ # @param [String] flow_sid The flow_sid
21
+ # @return [ExecutionList] ExecutionList
22
+ def initialize(version, flow_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {flow_sid: flow_sid}
27
+ @uri = "/Flows/#{@solution[:flow_sid]}/Executions"
28
+ end
29
+
30
+ ##
31
+ # Lists ExecutionInstance 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 ExecutionInstance 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 ExecutionInstance 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 ExecutionInstance 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 ExecutionInstance
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
+ ExecutionPage.new(@version, response, @solution)
97
+ end
98
+
99
+ ##
100
+ # Retrieve a single page of ExecutionInstance 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 ExecutionInstance
104
+ def get_page(target_url)
105
+ response = @version.domain.request(
106
+ 'GET',
107
+ target_url
108
+ )
109
+ ExecutionPage.new(@version, response, @solution)
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of ExecutionInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [String] to The to
116
+ # @param [String] from The from
117
+ # @param [Hash] parameters The parameters
118
+ # @return [ExecutionInstance] Newly created ExecutionInstance
119
+ def create(to: nil, from: nil, parameters: :unset)
120
+ data = Twilio::Values.of({
121
+ 'To' => to,
122
+ 'From' => from,
123
+ 'Parameters' => Twilio.serialize_object(parameters),
124
+ })
125
+
126
+ payload = @version.create(
127
+ 'POST',
128
+ @uri,
129
+ data: data
130
+ )
131
+
132
+ ExecutionInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
133
+ end
134
+
135
+ ##
136
+ # Provide a user friendly representation
137
+ def to_s
138
+ '#<Twilio.Studio.V1.ExecutionList>'
139
+ end
140
+ end
141
+
142
+ ##
143
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
144
+ class ExecutionPage < Page
145
+ ##
146
+ # Initialize the ExecutionPage
147
+ # @param [Version] version Version that contains the resource
148
+ # @param [Response] response Response from the API
149
+ # @param [Hash] solution Path solution for the resource
150
+ # @return [ExecutionPage] ExecutionPage
151
+ def initialize(version, response, solution)
152
+ super(version, response)
153
+
154
+ # Path Solution
155
+ @solution = solution
156
+ end
157
+
158
+ ##
159
+ # Build an instance of ExecutionInstance
160
+ # @param [Hash] payload Payload response from the API
161
+ # @return [ExecutionInstance] ExecutionInstance
162
+ def get_instance(payload)
163
+ ExecutionInstance.new(@version, payload, flow_sid: @solution[:flow_sid], )
164
+ end
165
+
166
+ ##
167
+ # Provide a user friendly representation
168
+ def to_s
169
+ '<Twilio.Studio.V1.ExecutionPage>'
170
+ end
171
+ end
172
+
173
+ ##
174
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
175
+ class ExecutionContext < InstanceContext
176
+ ##
177
+ # Initialize the ExecutionContext
178
+ # @param [Version] version Version that contains the resource
179
+ # @param [String] flow_sid The flow_sid
180
+ # @param [String] sid The sid
181
+ # @return [ExecutionContext] ExecutionContext
182
+ def initialize(version, flow_sid, sid)
183
+ super(version)
184
+
185
+ # Path Solution
186
+ @solution = {flow_sid: flow_sid, sid: sid, }
187
+ @uri = "/Flows/#{@solution[:flow_sid]}/Executions/#{@solution[:sid]}"
188
+
189
+ # Dependents
190
+ @steps = nil
191
+ @execution_context = nil
192
+ end
193
+
194
+ ##
195
+ # Fetch a ExecutionInstance
196
+ # @return [ExecutionInstance] Fetched ExecutionInstance
197
+ def fetch
198
+ params = Twilio::Values.of({})
199
+
200
+ payload = @version.fetch(
201
+ 'GET',
202
+ @uri,
203
+ params,
204
+ )
205
+
206
+ ExecutionInstance.new(@version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], )
207
+ end
208
+
209
+ ##
210
+ # Deletes the ExecutionInstance
211
+ # @return [Boolean] true if delete succeeds, true otherwise
212
+ def delete
213
+ @version.delete('delete', @uri)
214
+ end
215
+
216
+ ##
217
+ # Access the steps
218
+ # @return [ExecutionStepList]
219
+ # @return [ExecutionStepContext] if sid was passed.
220
+ def steps(sid=:unset)
221
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
222
+
223
+ if sid != :unset
224
+ return ExecutionStepContext.new(@version, @solution[:flow_sid], @solution[:sid], sid, )
225
+ end
226
+
227
+ unless @steps
228
+ @steps = ExecutionStepList.new(
229
+ @version,
230
+ flow_sid: @solution[:flow_sid],
231
+ execution_sid: @solution[:sid],
232
+ )
233
+ end
234
+
235
+ @steps
236
+ end
237
+
238
+ ##
239
+ # Access the execution_context
240
+ # @return [ExecutionContextList]
241
+ # @return [ExecutionContextContext]
242
+ def execution_context
243
+ ExecutionContextContext.new(@version, @solution[:flow_sid], @solution[:sid], )
244
+ end
245
+
246
+ ##
247
+ # Provide a user friendly representation
248
+ def to_s
249
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
250
+ "#<Twilio.Studio.V1.ExecutionContext #{context}>"
251
+ end
252
+ end
253
+
254
+ ##
255
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
256
+ class ExecutionInstance < InstanceResource
257
+ ##
258
+ # Initialize the ExecutionInstance
259
+ # @param [Version] version Version that contains the resource
260
+ # @param [Hash] payload payload that contains response from Twilio
261
+ # @param [String] flow_sid The flow_sid
262
+ # @param [String] sid The sid
263
+ # @return [ExecutionInstance] ExecutionInstance
264
+ def initialize(version, payload, flow_sid: nil, sid: nil)
265
+ super(version)
266
+
267
+ # Marshaled Properties
268
+ @properties = {
269
+ 'sid' => payload['sid'],
270
+ 'account_sid' => payload['account_sid'],
271
+ 'flow_sid' => payload['flow_sid'],
272
+ 'contact_sid' => payload['contact_sid'],
273
+ 'contact_channel_address' => payload['contact_channel_address'],
274
+ 'context' => payload['context'],
275
+ 'status' => payload['status'],
276
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
277
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
278
+ 'url' => payload['url'],
279
+ 'links' => payload['links'],
280
+ }
281
+
282
+ # Context
283
+ @instance_context = nil
284
+ @params = {'flow_sid' => flow_sid, 'sid' => sid || @properties['sid'], }
285
+ end
286
+
287
+ ##
288
+ # Generate an instance context for the instance, the context is capable of
289
+ # performing various actions. All instance actions are proxied to the context
290
+ # @return [ExecutionContext] ExecutionContext for this ExecutionInstance
291
+ def context
292
+ unless @instance_context
293
+ @instance_context = ExecutionContext.new(@version, @params['flow_sid'], @params['sid'], )
294
+ end
295
+ @instance_context
296
+ end
297
+
298
+ ##
299
+ # @return [String] The sid
300
+ def sid
301
+ @properties['sid']
302
+ end
303
+
304
+ ##
305
+ # @return [String] The account_sid
306
+ def account_sid
307
+ @properties['account_sid']
308
+ end
309
+
310
+ ##
311
+ # @return [String] The flow_sid
312
+ def flow_sid
313
+ @properties['flow_sid']
314
+ end
315
+
316
+ ##
317
+ # @return [String] The contact_sid
318
+ def contact_sid
319
+ @properties['contact_sid']
320
+ end
321
+
322
+ ##
323
+ # @return [String] The contact_channel_address
324
+ def contact_channel_address
325
+ @properties['contact_channel_address']
326
+ end
327
+
328
+ ##
329
+ # @return [Hash] The context
330
+ def context
331
+ @properties['context']
332
+ end
333
+
334
+ ##
335
+ # @return [execution.Status] The status
336
+ def status
337
+ @properties['status']
338
+ end
339
+
340
+ ##
341
+ # @return [Time] The date_created
342
+ def date_created
343
+ @properties['date_created']
344
+ end
345
+
346
+ ##
347
+ # @return [Time] The date_updated
348
+ def date_updated
349
+ @properties['date_updated']
350
+ end
351
+
352
+ ##
353
+ # @return [String] The url
354
+ def url
355
+ @properties['url']
356
+ end
357
+
358
+ ##
359
+ # @return [String] The links
360
+ def links
361
+ @properties['links']
362
+ end
363
+
364
+ ##
365
+ # Fetch a ExecutionInstance
366
+ # @return [ExecutionInstance] Fetched ExecutionInstance
367
+ def fetch
368
+ context.fetch
369
+ end
370
+
371
+ ##
372
+ # Deletes the ExecutionInstance
373
+ # @return [Boolean] true if delete succeeds, true otherwise
374
+ def delete
375
+ context.delete
376
+ end
377
+
378
+ ##
379
+ # Access the steps
380
+ # @return [steps] steps
381
+ def steps
382
+ context.steps
383
+ end
384
+
385
+ ##
386
+ # Access the execution_context
387
+ # @return [execution_context] execution_context
388
+ def execution_context
389
+ context.execution_context
390
+ end
391
+
392
+ ##
393
+ # Provide a user friendly representation
394
+ def to_s
395
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
396
+ "<Twilio.Studio.V1.ExecutionInstance #{values}>"
397
+ end
398
+
399
+ ##
400
+ # Provide a detailed, user friendly representation
401
+ def inspect
402
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
403
+ "<Twilio.Studio.V1.ExecutionInstance #{values}>"
404
+ end
405
+ end
406
+ end
407
+ end
408
+ end
409
+ end
410
+ end