twilio-ruby 5.61.0 → 5.63.0

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/{deploy.yml → test-and-deploy.yml} +55 -18
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +1 -1
  5. data/CHANGES.md +98 -0
  6. data/Makefile +3 -3
  7. data/README.md +4 -4
  8. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +3 -3
  9. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +19 -5
  10. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  11. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  12. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  13. data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +31 -6
  14. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  15. data/lib/twilio-ruby/rest/insights/v1.rb +7 -0
  16. data/lib/twilio-ruby/rest/insights.rb +6 -0
  17. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +14 -1
  18. data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +84 -3
  19. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +24 -2
  20. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +80 -0
  21. data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +416 -0
  22. data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
  23. data/lib/twilio-ruby/rest/supersim.rb +9 -0
  24. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +8 -2
  25. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +12 -2
  26. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +2 -2
  27. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -0
  28. data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
  29. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  30. data/lib/twilio-ruby/rest/video/v1/room.rb +34 -1
  31. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  32. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  33. data/lib/twilio-ruby/rest/voice.rb +8 -0
  34. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +4 -4
  35. data/lib/twilio-ruby/twiml/voice_response.rb +613 -36
  36. data/lib/twilio-ruby/version.rb +1 -1
  37. metadata +7 -9
  38. data/.github/workflows/test.yml +0 -51
  39. data/.yardoc/checksums +0 -532
  40. data/.yardoc/complete +0 -0
  41. data/.yardoc/object_types +0 -0
  42. data/.yardoc/objects/root.dat +0 -0
  43. data/.yardoc/proxy_types +0 -0
@@ -168,6 +168,8 @@ module Twilio
168
168
  'markdown' => payload['markdown'],
169
169
  'url' => payload['url'],
170
170
  'flex_insights_hr' => payload['flex_insights_hr'],
171
+ 'flex_insights_drilldown' => payload['flex_insights_drilldown'],
172
+ 'flex_url' => payload['flex_url'],
171
173
  }
172
174
 
173
175
  # Context
@@ -426,6 +428,18 @@ module Twilio
426
428
  @properties['flex_insights_hr']
427
429
  end
428
430
 
431
+ ##
432
+ # @return [Boolean] Setting to enable Flex UI redirection
433
+ def flex_insights_drilldown
434
+ @properties['flex_insights_drilldown']
435
+ end
436
+
437
+ ##
438
+ # @return [String] URL to redirect to in case drilldown is enabled.
439
+ def flex_url
440
+ @properties['flex_url']
441
+ end
442
+
429
443
  ##
430
444
  # Fetch the ConfigurationInstance
431
445
  # @param [String] ui_version The Pinned UI version of the Configuration resource
@@ -94,10 +94,19 @@ module Twilio
94
94
  # @param [String] avatar The avatar URL which will be shown in Frontline
95
95
  # application.
96
96
  # @param [user.StateType] state Current state of this user. Can be either `active`
97
- # or `deactivated` and defaults to `active`
97
+ # or `deactivated`.
98
+ # @param [Boolean] is_available Whether the User is available for new
99
+ # conversations. Set to `false` to prevent User from receiving new inbound
100
+ # conversations if you are using {Pool
101
+ # Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
98
102
  # @return [UserInstance] Updated UserInstance
99
- def update(friendly_name: :unset, avatar: :unset, state: :unset)
100
- data = Twilio::Values.of({'FriendlyName' => friendly_name, 'Avatar' => avatar, 'State' => state, })
103
+ def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
104
+ data = Twilio::Values.of({
105
+ 'FriendlyName' => friendly_name,
106
+ 'Avatar' => avatar,
107
+ 'State' => state,
108
+ 'IsAvailable' => is_available,
109
+ })
101
110
 
102
111
  payload = @version.update('POST', @uri, data: data)
103
112
 
@@ -139,6 +148,7 @@ module Twilio
139
148
  'friendly_name' => payload['friendly_name'],
140
149
  'avatar' => payload['avatar'],
141
150
  'state' => payload['state'],
151
+ 'is_available' => payload['is_available'],
142
152
  'url' => payload['url'],
143
153
  }
144
154
 
@@ -188,6 +198,12 @@ module Twilio
188
198
  @properties['state']
189
199
  end
190
200
 
201
+ ##
202
+ # @return [Boolean] Whether the User is available for new conversations
203
+ def is_available
204
+ @properties['is_available']
205
+ end
206
+
191
207
  ##
192
208
  # @return [String] An absolute URL for this user.
193
209
  def url
@@ -207,10 +223,19 @@ module Twilio
207
223
  # @param [String] avatar The avatar URL which will be shown in Frontline
208
224
  # application.
209
225
  # @param [user.StateType] state Current state of this user. Can be either `active`
210
- # or `deactivated` and defaults to `active`
226
+ # or `deactivated`.
227
+ # @param [Boolean] is_available Whether the User is available for new
228
+ # conversations. Set to `false` to prevent User from receiving new inbound
229
+ # conversations if you are using {Pool
230
+ # Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
211
231
  # @return [UserInstance] Updated UserInstance
212
- def update(friendly_name: :unset, avatar: :unset, state: :unset)
213
- context.update(friendly_name: friendly_name, avatar: avatar, state: state, )
232
+ def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
233
+ context.update(
234
+ friendly_name: friendly_name,
235
+ avatar: avatar,
236
+ state: state,
237
+ is_available: is_available,
238
+ )
214
239
  end
215
240
 
216
241
  ##
@@ -0,0 +1,215 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Insights < Domain
12
+ class V1 < Version
13
+ class SettingList < ListResource
14
+ ##
15
+ # Initialize the SettingList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [SettingList] SettingList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ end
24
+
25
+ ##
26
+ # Provide a user friendly representation
27
+ def to_s
28
+ '#<Twilio.Insights.V1.SettingList>'
29
+ end
30
+ end
31
+
32
+ class SettingPage < Page
33
+ ##
34
+ # Initialize the SettingPage
35
+ # @param [Version] version Version that contains the resource
36
+ # @param [Response] response Response from the API
37
+ # @param [Hash] solution Path solution for the resource
38
+ # @return [SettingPage] SettingPage
39
+ def initialize(version, response, solution)
40
+ super(version, response)
41
+
42
+ # Path Solution
43
+ @solution = solution
44
+ end
45
+
46
+ ##
47
+ # Build an instance of SettingInstance
48
+ # @param [Hash] payload Payload response from the API
49
+ # @return [SettingInstance] SettingInstance
50
+ def get_instance(payload)
51
+ SettingInstance.new(@version, payload, )
52
+ end
53
+
54
+ ##
55
+ # Provide a user friendly representation
56
+ def to_s
57
+ '<Twilio.Insights.V1.SettingPage>'
58
+ end
59
+ end
60
+
61
+ class SettingContext < InstanceContext
62
+ ##
63
+ # Initialize the SettingContext
64
+ # @param [Version] version Version that contains the resource
65
+ # @return [SettingContext] SettingContext
66
+ def initialize(version)
67
+ super(version)
68
+
69
+ # Path Solution
70
+ @solution = {}
71
+ @uri = "/Voice/Settings"
72
+ end
73
+
74
+ ##
75
+ # Fetch the SettingInstance
76
+ # @param [String] subaccount_sid The subaccount_sid
77
+ # @return [SettingInstance] Fetched SettingInstance
78
+ def fetch(subaccount_sid: :unset)
79
+ params = Twilio::Values.of({'SubaccountSid' => subaccount_sid, })
80
+
81
+ payload = @version.fetch('GET', @uri, params: params)
82
+
83
+ SettingInstance.new(@version, payload, )
84
+ end
85
+
86
+ ##
87
+ # Update the SettingInstance
88
+ # @param [Boolean] advanced_features The advanced_features
89
+ # @param [Boolean] voice_trace The voice_trace
90
+ # @param [String] subaccount_sid The subaccount_sid
91
+ # @return [SettingInstance] Updated SettingInstance
92
+ def update(advanced_features: :unset, voice_trace: :unset, subaccount_sid: :unset)
93
+ data = Twilio::Values.of({
94
+ 'AdvancedFeatures' => advanced_features,
95
+ 'VoiceTrace' => voice_trace,
96
+ 'SubaccountSid' => subaccount_sid,
97
+ })
98
+
99
+ payload = @version.update('POST', @uri, data: data)
100
+
101
+ SettingInstance.new(@version, payload, )
102
+ end
103
+
104
+ ##
105
+ # Provide a user friendly representation
106
+ def to_s
107
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
108
+ "#<Twilio.Insights.V1.SettingContext #{context}>"
109
+ end
110
+
111
+ ##
112
+ # Provide a detailed, user friendly representation
113
+ def inspect
114
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
115
+ "#<Twilio.Insights.V1.SettingContext #{context}>"
116
+ end
117
+ end
118
+
119
+ class SettingInstance < InstanceResource
120
+ ##
121
+ # Initialize the SettingInstance
122
+ # @param [Version] version Version that contains the resource
123
+ # @param [Hash] payload payload that contains response from Twilio
124
+ # @return [SettingInstance] SettingInstance
125
+ def initialize(version, payload)
126
+ super(version)
127
+
128
+ # Marshaled Properties
129
+ @properties = {
130
+ 'account_sid' => payload['account_sid'],
131
+ 'advanced_features' => payload['advanced_features'],
132
+ 'voice_trace' => payload['voice_trace'],
133
+ 'url' => payload['url'],
134
+ }
135
+
136
+ # Context
137
+ @instance_context = nil
138
+ @params = {}
139
+ end
140
+
141
+ ##
142
+ # Generate an instance context for the instance, the context is capable of
143
+ # performing various actions. All instance actions are proxied to the context
144
+ # @return [SettingContext] SettingContext for this SettingInstance
145
+ def context
146
+ unless @instance_context
147
+ @instance_context = SettingContext.new(@version, )
148
+ end
149
+ @instance_context
150
+ end
151
+
152
+ ##
153
+ # @return [String] The account_sid
154
+ def account_sid
155
+ @properties['account_sid']
156
+ end
157
+
158
+ ##
159
+ # @return [Boolean] The advanced_features
160
+ def advanced_features
161
+ @properties['advanced_features']
162
+ end
163
+
164
+ ##
165
+ # @return [Boolean] The voice_trace
166
+ def voice_trace
167
+ @properties['voice_trace']
168
+ end
169
+
170
+ ##
171
+ # @return [String] The url
172
+ def url
173
+ @properties['url']
174
+ end
175
+
176
+ ##
177
+ # Fetch the SettingInstance
178
+ # @param [String] subaccount_sid The subaccount_sid
179
+ # @return [SettingInstance] Fetched SettingInstance
180
+ def fetch(subaccount_sid: :unset)
181
+ context.fetch(subaccount_sid: subaccount_sid, )
182
+ end
183
+
184
+ ##
185
+ # Update the SettingInstance
186
+ # @param [Boolean] advanced_features The advanced_features
187
+ # @param [Boolean] voice_trace The voice_trace
188
+ # @param [String] subaccount_sid The subaccount_sid
189
+ # @return [SettingInstance] Updated SettingInstance
190
+ def update(advanced_features: :unset, voice_trace: :unset, subaccount_sid: :unset)
191
+ context.update(
192
+ advanced_features: advanced_features,
193
+ voice_trace: voice_trace,
194
+ subaccount_sid: subaccount_sid,
195
+ )
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.Insights.V1.SettingInstance #{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.Insights.V1.SettingInstance #{values}>"
210
+ end
211
+ end
212
+ end
213
+ end
214
+ end
215
+ end
@@ -15,11 +15,18 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v1'
18
+ @settings = nil
18
19
  @calls = nil
19
20
  @call_summaries = nil
20
21
  @rooms = nil
21
22
  end
22
23
 
24
+ ##
25
+ # @return [Twilio::REST::Insights::V1::SettingContext]
26
+ def settings
27
+ @settings ||= SettingContext.new self
28
+ end
29
+
23
30
  ##
24
31
  # @param [String] sid The sid
25
32
  # @return [Twilio::REST::Insights::V1::CallContext] if sid was passed.
@@ -28,6 +28,12 @@ module Twilio
28
28
  @v1 ||= V1.new self
29
29
  end
30
30
 
31
+ ##
32
+ # @return [Twilio::REST::Insights::V1::SettingInstance]
33
+ def settings
34
+ self.v1.settings()
35
+ end
36
+
31
37
  ##
32
38
  # @param [String] sid The sid
33
39
  # @return [Twilio::REST::Insights::V1::CallInstance] if sid was passed.
@@ -42,14 +42,20 @@ module Twilio
42
42
  # Callbacks}[/docs/live/status-callbacks] for details.
43
43
  # @param [String] status_callback_method The HTTP method Twilio should use to call
44
44
  # the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`.
45
+ # @param [String] max_duration The maximum time, in seconds, that the
46
+ # MediaProcessor can run before automatically ends. The default value is 300
47
+ # seconds, and the maximum value is 90000 seconds. Once this maximum duration is
48
+ # reached, Twilio will end the MediaProcessor, regardless of whether media is
49
+ # still streaming.
45
50
  # @return [MediaProcessorInstance] Created MediaProcessorInstance
46
- def create(extension: nil, extension_context: nil, extension_environment: :unset, status_callback: :unset, status_callback_method: :unset)
51
+ def create(extension: nil, extension_context: nil, extension_environment: :unset, status_callback: :unset, status_callback_method: :unset, max_duration: :unset)
47
52
  data = Twilio::Values.of({
48
53
  'Extension' => extension,
49
54
  'ExtensionContext' => extension_context,
50
55
  'ExtensionEnvironment' => Twilio.serialize_object(extension_environment),
51
56
  'StatusCallback' => status_callback,
52
57
  'StatusCallbackMethod' => status_callback_method,
58
+ 'MaxDuration' => max_duration,
53
59
  })
54
60
 
55
61
  payload = @version.create('POST', @uri, data: data)
@@ -264,6 +270,7 @@ module Twilio
264
270
  'ended_reason' => payload['ended_reason'],
265
271
  'status_callback' => payload['status_callback'],
266
272
  'status_callback_method' => payload['status_callback_method'],
273
+ 'max_duration' => payload['max_duration'].to_i,
267
274
  }
268
275
 
269
276
  # Context
@@ -348,6 +355,12 @@ module Twilio
348
355
  @properties['status_callback_method']
349
356
  end
350
357
 
358
+ ##
359
+ # @return [String] Maximum MediaProcessor duration in minutes
360
+ def max_duration
361
+ @properties['max_duration']
362
+ end
363
+
351
364
  ##
352
365
  # Fetch the MediaProcessorInstance
353
366
  # @return [MediaProcessorInstance] Fetched MediaProcessorInstance
@@ -166,6 +166,54 @@ module Twilio
166
166
  end
167
167
  end
168
168
 
169
+ ##
170
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
171
+ class BrandVettingContext < InstanceContext
172
+ ##
173
+ # Initialize the BrandVettingContext
174
+ # @param [Version] version Version that contains the resource
175
+ # @param [String] brand_sid The SID of the Brand Registration resource of the
176
+ # vettings to read .
177
+ # @param [String] brand_vetting_sid The Twilio SID of the third-party vetting
178
+ # record.
179
+ # @return [BrandVettingContext] BrandVettingContext
180
+ def initialize(version, brand_sid, brand_vetting_sid)
181
+ super(version)
182
+
183
+ # Path Solution
184
+ @solution = {brand_sid: brand_sid, brand_vetting_sid: brand_vetting_sid, }
185
+ @uri = "/a2p/BrandRegistrations/#{@solution[:brand_sid]}/Vettings/#{@solution[:brand_vetting_sid]}"
186
+ end
187
+
188
+ ##
189
+ # Fetch the BrandVettingInstance
190
+ # @return [BrandVettingInstance] Fetched BrandVettingInstance
191
+ def fetch
192
+ payload = @version.fetch('GET', @uri)
193
+
194
+ BrandVettingInstance.new(
195
+ @version,
196
+ payload,
197
+ brand_sid: @solution[:brand_sid],
198
+ brand_vetting_sid: @solution[:brand_vetting_sid],
199
+ )
200
+ end
201
+
202
+ ##
203
+ # Provide a user friendly representation
204
+ def to_s
205
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
206
+ "#<Twilio.Messaging.V1.BrandVettingContext #{context}>"
207
+ end
208
+
209
+ ##
210
+ # Provide a detailed, user friendly representation
211
+ def inspect
212
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
213
+ "#<Twilio.Messaging.V1.BrandVettingContext #{context}>"
214
+ end
215
+ end
216
+
169
217
  ##
170
218
  # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
171
219
  class BrandVettingInstance < InstanceResource
@@ -174,8 +222,10 @@ module Twilio
174
222
  # @param [Version] version Version that contains the resource
175
223
  # @param [Hash] payload payload that contains response from Twilio
176
224
  # @param [String] brand_sid The unique string to identify Brand Registration.
225
+ # @param [String] brand_vetting_sid The Twilio SID of the third-party vetting
226
+ # record.
177
227
  # @return [BrandVettingInstance] BrandVettingInstance
178
- def initialize(version, payload, brand_sid: nil)
228
+ def initialize(version, payload, brand_sid: nil, brand_vetting_sid: nil)
179
229
  super(version)
180
230
 
181
231
  # Marshaled Properties
@@ -191,6 +241,28 @@ module Twilio
191
241
  'vetting_provider' => payload['vetting_provider'],
192
242
  'url' => payload['url'],
193
243
  }
244
+
245
+ # Context
246
+ @instance_context = nil
247
+ @params = {
248
+ 'brand_sid' => brand_sid,
249
+ 'brand_vetting_sid' => brand_vetting_sid || @properties['brand_vetting_sid'],
250
+ }
251
+ end
252
+
253
+ ##
254
+ # Generate an instance context for the instance, the context is capable of
255
+ # performing various actions. All instance actions are proxied to the context
256
+ # @return [BrandVettingContext] BrandVettingContext for this BrandVettingInstance
257
+ def context
258
+ unless @instance_context
259
+ @instance_context = BrandVettingContext.new(
260
+ @version,
261
+ @params['brand_sid'],
262
+ @params['brand_vetting_sid'],
263
+ )
264
+ end
265
+ @instance_context
194
266
  end
195
267
 
196
268
  ##
@@ -253,16 +325,25 @@ module Twilio
253
325
  @properties['url']
254
326
  end
255
327
 
328
+ ##
329
+ # Fetch the BrandVettingInstance
330
+ # @return [BrandVettingInstance] Fetched BrandVettingInstance
331
+ def fetch
332
+ context.fetch
333
+ end
334
+
256
335
  ##
257
336
  # Provide a user friendly representation
258
337
  def to_s
259
- "<Twilio.Messaging.V1.BrandVettingInstance>"
338
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
339
+ "<Twilio.Messaging.V1.BrandVettingInstance #{values}>"
260
340
  end
261
341
 
262
342
  ##
263
343
  # Provide a detailed, user friendly representation
264
344
  def inspect
265
- "<Twilio.Messaging.V1.BrandVettingInstance>"
345
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
346
+ "<Twilio.Messaging.V1.BrandVettingInstance #{values}>"
266
347
  end
267
348
  end
268
349
  end
@@ -198,11 +198,26 @@ module Twilio
198
198
  BrandRegistrationInstance.new(@version, payload, sid: @solution[:sid], )
199
199
  end
200
200
 
201
+ ##
202
+ # Update the BrandRegistrationInstance
203
+ # @return [BrandRegistrationInstance] Updated BrandRegistrationInstance
204
+ def update
205
+ payload = @version.update('POST', @uri)
206
+
207
+ BrandRegistrationInstance.new(@version, payload, sid: @solution[:sid], )
208
+ end
209
+
201
210
  ##
202
211
  # Access the brand_vettings
203
212
  # @return [BrandVettingList]
204
- # @return [BrandVettingContext]
205
- def brand_vettings
213
+ # @return [BrandVettingContext] if brand_vetting_sid was passed.
214
+ def brand_vettings(brand_vetting_sid=:unset)
215
+ raise ArgumentError, 'brand_vetting_sid cannot be nil' if brand_vetting_sid.nil?
216
+
217
+ if brand_vetting_sid != :unset
218
+ return BrandVettingContext.new(@version, @solution[:sid], brand_vetting_sid, )
219
+ end
220
+
206
221
  unless @brand_vettings
207
222
  @brand_vettings = BrandVettingList.new(@version, brand_sid: @solution[:sid], )
208
223
  end
@@ -397,6 +412,13 @@ module Twilio
397
412
  context.fetch
398
413
  end
399
414
 
415
+ ##
416
+ # Update the BrandRegistrationInstance
417
+ # @return [BrandRegistrationInstance] Updated BrandRegistrationInstance
418
+ def update
419
+ context.update
420
+ end
421
+
400
422
  ##
401
423
  # Access the brand_vettings
402
424
  # @return [brand_vettings] brand_vettings
@@ -42,6 +42,86 @@ module Twilio
42
42
  BundleCopyInstance.new(@version, payload, bundle_sid: @solution[:bundle_sid], )
43
43
  end
44
44
 
45
+ ##
46
+ # Lists BundleCopyInstance records from the API as a list.
47
+ # Unlike stream(), this operation is eager and will load `limit` records into
48
+ # memory before returning.
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 [Array] Array of up to limit results
56
+ def list(limit: nil, page_size: nil)
57
+ self.stream(limit: limit, page_size: page_size).entries
58
+ end
59
+
60
+ ##
61
+ # Streams BundleCopyInstance records from the API as an Enumerable.
62
+ # This operation lazily loads records as efficiently as possible until the limit
63
+ # is reached.
64
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
65
+ # guarantees to never return more than limit. Default is no limit.
66
+ # @param [Integer] page_size Number of records to fetch per request, when
67
+ # not set will use the default value of 50 records. If no page_size is defined
68
+ # but a limit is defined, stream() will attempt to read the limit with the most
69
+ # efficient page size, i.e. min(limit, 1000)
70
+ # @return [Enumerable] Enumerable that will yield up to limit results
71
+ def stream(limit: nil, page_size: nil)
72
+ limits = @version.read_limits(limit, page_size)
73
+
74
+ page = self.page(page_size: limits[:page_size], )
75
+
76
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
77
+ end
78
+
79
+ ##
80
+ # When passed a block, yields BundleCopyInstance records from the API.
81
+ # This operation lazily loads records as efficiently as possible until the limit
82
+ # is reached.
83
+ def each
84
+ limits = @version.read_limits
85
+
86
+ page = self.page(page_size: limits[:page_size], )
87
+
88
+ @version.stream(page,
89
+ limit: limits[:limit],
90
+ page_limit: limits[:page_limit]).each {|x| yield x}
91
+ end
92
+
93
+ ##
94
+ # Retrieve a single page of BundleCopyInstance records from the API.
95
+ # Request is executed immediately.
96
+ # @param [String] page_token PageToken provided by the API
97
+ # @param [Integer] page_number Page Number, this value is simply for client state
98
+ # @param [Integer] page_size Number of records to return, defaults to 50
99
+ # @return [Page] Page of BundleCopyInstance
100
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
101
+ params = Twilio::Values.of({
102
+ 'PageToken' => page_token,
103
+ 'Page' => page_number,
104
+ 'PageSize' => page_size,
105
+ })
106
+
107
+ response = @version.page('GET', @uri, params: params)
108
+
109
+ BundleCopyPage.new(@version, response, @solution)
110
+ end
111
+
112
+ ##
113
+ # Retrieve a single page of BundleCopyInstance records from the API.
114
+ # Request is executed immediately.
115
+ # @param [String] target_url API-generated URL for the requested results page
116
+ # @return [Page] Page of BundleCopyInstance
117
+ def get_page(target_url)
118
+ response = @version.domain.request(
119
+ 'GET',
120
+ target_url
121
+ )
122
+ BundleCopyPage.new(@version, response, @solution)
123
+ end
124
+
45
125
  ##
46
126
  # Provide a user friendly representation
47
127
  def to_s