twilio-ruby 5.18.0 → 5.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -4
- data/CHANGES.md +20 -0
- data/LICENSE.md +1 -1
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/accounts/v1/credential/aws.rb +21 -13
- data/lib/twilio-ruby/rest/accounts/v1/credential.rb +2 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +4 -4
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +6 -6
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +80 -70
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +204 -196
- data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +59 -53
- data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +69 -61
- data/lib/twilio-ruby/rest/api/v2010/account/message/media.rb +30 -25
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +28 -16
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +31 -20
- data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +54 -50
- data/lib/twilio-ruby/rest/api.rb +7 -6
- data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
- data/lib/twilio-ruby/rest/authy.rb +8 -8
- data/lib/twilio-ruby/rest/client.rb +14 -6
- data/lib/twilio-ruby/rest/insights/v1/summary.rb +286 -0
- data/lib/twilio-ruby/rest/insights/v1.rb +43 -0
- data/lib/twilio-ruby/rest/insights.rb +46 -0
- data/lib/twilio-ruby/rest/messaging/v1/service/short_code.rb +22 -14
- data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
- data/lib/twilio-ruby/rest/preview.rb +8 -8
- data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +5 -28
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +5 -9
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +5 -13
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb +1 -1
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +1 -1
- data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +4 -2
- data/lib/twilio-ruby/rest/trunking/v1.rb +2 -1
- data/lib/twilio-ruby/rest/verify/v1/service/verification.rb +7 -0
- data/lib/twilio-ruby/rest/verify/v1/service/verification_check.rb +7 -4
- data/lib/twilio-ruby/rest/video/v1/composition.rb +25 -13
- data/lib/twilio-ruby/rest/video/v1/composition_hook.rb +69 -74
- data/lib/twilio-ruby/rest/video/v1/recording.rb +13 -7
- data/lib/twilio-ruby/rest/video/v1.rb +16 -16
- data/lib/twilio-ruby/rest/video.rb +9 -9
- data/lib/twilio-ruby/rest/voice/v1/voice_permission/bulk_country_update.rb +3 -3
- data/lib/twilio-ruby/rest/voice/v1/voice_permission/country/highrisk_special_prefix.rb +2 -2
- data/lib/twilio-ruby/rest/voice/v1/voice_permission/country.rb +20 -20
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/sip/domain_spec.rb +8 -4
- data/spec/integration/insights/v1/summary_spec.rb +60 -0
- data/spec/integration/proxy/v1/service/phone_number_spec.rb +2 -2
- data/spec/integration/proxy/v1/service/session/interaction_spec.rb +1 -1
- data/spec/integration/proxy/v1/service/session/participant/message_interaction_spec.rb +2 -2
- data/spec/integration/proxy/v1/service/session/participant_spec.rb +66 -4
- data/spec/integration/proxy/v1/service/session_spec.rb +8 -8
- data/spec/integration/proxy/v1/service_spec.rb +3 -3
- data/spec/integration/trunking/v1/trunk_spec.rb +80 -0
- data/spec/integration/verify/v1/service/verification_spec.rb +10 -1
- data/twilio-ruby.gemspec +1 -2
- metadata +16 -6
@@ -0,0 +1,43 @@
|
|
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
|
12
|
+
class V1 < Version
|
13
|
+
##
|
14
|
+
# Initialize the V1 version of Insights
|
15
|
+
def initialize(domain)
|
16
|
+
super
|
17
|
+
@version = 'v1'
|
18
|
+
@summary = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# @param [String] call_sid The call_sid
|
23
|
+
# @return [Twilio::REST::Insights::V1::CallSummaryContext] if call_sid was passed.
|
24
|
+
# @return [Twilio::REST::Insights::V1::CallSummaryList]
|
25
|
+
def summary(call_sid=:unset)
|
26
|
+
if call_sid.nil?
|
27
|
+
raise ArgumentError, 'call_sid cannot be nil'
|
28
|
+
elsif call_sid == :unset
|
29
|
+
@summary ||= CallSummaryList.new self
|
30
|
+
else
|
31
|
+
CallSummaryContext.new(self, call_sid)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Provide a user friendly representation
|
37
|
+
def to_s
|
38
|
+
'<Twilio::REST::Insights::V1>'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
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
|
+
##
|
13
|
+
# Initialize the Insights Domain
|
14
|
+
def initialize(twilio)
|
15
|
+
super
|
16
|
+
|
17
|
+
@base_url = 'https://insights.twilio.com'
|
18
|
+
@host = 'insights.twilio.com'
|
19
|
+
@port = 443
|
20
|
+
|
21
|
+
# Versions
|
22
|
+
@v1 = nil
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Version v1 of insights
|
27
|
+
def v1
|
28
|
+
@v1 ||= V1.new self
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# @param [String] call_sid The call_sid
|
33
|
+
# @return [Twilio::REST::Insights::V1::CallSummaryInstance] if call_sid was passed.
|
34
|
+
# @return [Twilio::REST::Insights::V1::CallSummaryList]
|
35
|
+
def summary(call_sid=:unset)
|
36
|
+
self.v1.summary(call_sid)
|
37
|
+
end
|
38
|
+
|
39
|
+
##
|
40
|
+
# Provide a user friendly representation
|
41
|
+
def to_s
|
42
|
+
'#<Twilio::REST::Insights>'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -17,7 +17,9 @@ module Twilio
|
|
17
17
|
##
|
18
18
|
# Initialize the ShortCodeList
|
19
19
|
# @param [Version] version Version that contains the resource
|
20
|
-
# @param [String] service_sid The
|
20
|
+
# @param [String] service_sid The SID of the
|
21
|
+
# [Service](https://www.twilio.com/docs/api/chat/rest/services) this resource is
|
22
|
+
# associated with.
|
21
23
|
# @return [ShortCodeList] ShortCodeList
|
22
24
|
def initialize(version, service_sid: nil)
|
23
25
|
super(version)
|
@@ -30,8 +32,8 @@ module Twilio
|
|
30
32
|
##
|
31
33
|
# Retrieve a single page of ShortCodeInstance records from the API.
|
32
34
|
# Request is executed immediately.
|
33
|
-
# @param [String] short_code_sid
|
34
|
-
# Service
|
35
|
+
# @param [String] short_code_sid SID of the ShortCode resource being added to the
|
36
|
+
# Service.
|
35
37
|
# @return [ShortCodeInstance] Newly created ShortCodeInstance
|
36
38
|
def create(short_code_sid: nil)
|
37
39
|
data = Twilio::Values.of({'ShortCodeSid' => short_code_sid, })
|
@@ -171,8 +173,11 @@ module Twilio
|
|
171
173
|
##
|
172
174
|
# Initialize the ShortCodeContext
|
173
175
|
# @param [Version] version Version that contains the resource
|
174
|
-
# @param [String] service_sid The
|
175
|
-
#
|
176
|
+
# @param [String] service_sid The SID of the
|
177
|
+
# [Service](https://www.twilio.com/docs/api/chat/rest/services) to fetch the
|
178
|
+
# resource from.
|
179
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
180
|
+
# ShortCode resource to fetch
|
176
181
|
# @return [ShortCodeContext] ShortCodeContext
|
177
182
|
def initialize(version, service_sid, sid)
|
178
183
|
super(version)
|
@@ -219,8 +224,11 @@ module Twilio
|
|
219
224
|
# Initialize the ShortCodeInstance
|
220
225
|
# @param [Version] version Version that contains the resource
|
221
226
|
# @param [Hash] payload payload that contains response from Twilio
|
222
|
-
# @param [String] service_sid The
|
223
|
-
#
|
227
|
+
# @param [String] service_sid The SID of the
|
228
|
+
# [Service](https://www.twilio.com/docs/api/chat/rest/services) this resource is
|
229
|
+
# associated with.
|
230
|
+
# @param [String] sid The Twilio-provided string that uniquely identifies the
|
231
|
+
# ShortCode resource to fetch
|
224
232
|
# @return [ShortCodeInstance] ShortCodeInstance
|
225
233
|
def initialize(version, payload, service_sid: nil, sid: nil)
|
226
234
|
super(version)
|
@@ -255,31 +263,31 @@ module Twilio
|
|
255
263
|
end
|
256
264
|
|
257
265
|
##
|
258
|
-
# @return [String] The
|
266
|
+
# @return [String] The unique string that identifies this resource
|
259
267
|
def sid
|
260
268
|
@properties['sid']
|
261
269
|
end
|
262
270
|
|
263
271
|
##
|
264
|
-
# @return [String] The
|
272
|
+
# @return [String] The SID of the Account that created this resource
|
265
273
|
def account_sid
|
266
274
|
@properties['account_sid']
|
267
275
|
end
|
268
276
|
|
269
277
|
##
|
270
|
-
# @return [String] The
|
278
|
+
# @return [String] The SID of the Service that this resource is associated with
|
271
279
|
def service_sid
|
272
280
|
@properties['service_sid']
|
273
281
|
end
|
274
282
|
|
275
283
|
##
|
276
|
-
# @return [Time]
|
284
|
+
# @return [Time] The RFC 2822 date and time in GMT that this resource was created
|
277
285
|
def date_created
|
278
286
|
@properties['date_created']
|
279
287
|
end
|
280
288
|
|
281
289
|
##
|
282
|
-
# @return [Time] The date that this resource was last updated
|
290
|
+
# @return [Time] The RFC 2822 date and time in GMT that this resource was last updated
|
283
291
|
def date_updated
|
284
292
|
@properties['date_updated']
|
285
293
|
end
|
@@ -291,7 +299,7 @@ module Twilio
|
|
291
299
|
end
|
292
300
|
|
293
301
|
##
|
294
|
-
# @return [String] The 2
|
302
|
+
# @return [String] The 2-character ISO Country Code of the number.
|
295
303
|
def country_code
|
296
304
|
@properties['country_code']
|
297
305
|
end
|
@@ -303,7 +311,7 @@ module Twilio
|
|
303
311
|
end
|
304
312
|
|
305
313
|
##
|
306
|
-
# @return [String] The
|
314
|
+
# @return [String] The absolute URL of this ShortCode resource
|
307
315
|
def url
|
308
316
|
@properties['url']
|
309
317
|
end
|
@@ -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
|
23
|
+
# @param [String] sid The Available Add-on Sid that uniquely identifies this
|
24
24
|
# resource
|
25
|
-
# @return [Twilio::REST::Preview::Marketplace::
|
26
|
-
# @return [Twilio::REST::Preview::Marketplace::
|
27
|
-
def
|
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
|
-
@
|
31
|
+
@available_add_ons ||= AvailableAddOnList.new self
|
32
32
|
else
|
33
|
-
|
33
|
+
AvailableAddOnContext.new(self, sid)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
##
|
38
|
-
# @param [String] sid The
|
38
|
+
# @param [String] sid The Installed Add-on Sid that uniquely identifies this
|
39
39
|
# resource
|
40
|
-
# @return [Twilio::REST::Preview::Marketplace::
|
41
|
-
# @return [Twilio::REST::Preview::Marketplace::
|
42
|
-
def
|
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
|
-
@
|
46
|
+
@installed_add_ons ||= InstalledAddOnList.new self
|
47
47
|
else
|
48
|
-
|
48
|
+
InstalledAddOnContext.new(self, sid)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -120,6 +120,14 @@ module Twilio
|
|
120
120
|
self.hosted_numbers.hosted_number_orders(sid)
|
121
121
|
end
|
122
122
|
|
123
|
+
##
|
124
|
+
# @param [String] sid A 34 character string that uniquely identifies this Add-on.
|
125
|
+
# @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
|
126
|
+
# @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
|
127
|
+
def available_add_ons(sid=:unset)
|
128
|
+
self.marketplace.available_add_ons(sid)
|
129
|
+
end
|
130
|
+
|
123
131
|
##
|
124
132
|
# @param [String] sid 34 character string that uniquely identifies the Add-on.
|
125
133
|
# This Sid can also be found in the Console on that specific Add-ons page as the
|
@@ -130,14 +138,6 @@ module Twilio
|
|
130
138
|
self.marketplace.installed_add_ons(sid)
|
131
139
|
end
|
132
140
|
|
133
|
-
##
|
134
|
-
# @param [String] sid A 34 character string that uniquely identifies this Add-on.
|
135
|
-
# @return [Twilio::REST::Preview::Marketplace::AvailableAddOnInstance] if sid was passed.
|
136
|
-
# @return [Twilio::REST::Preview::Marketplace::AvailableAddOnList]
|
137
|
-
def available_add_ons(sid=:unset)
|
138
|
-
self.marketplace.available_add_ons(sid)
|
139
|
-
end
|
140
|
-
|
141
141
|
##
|
142
142
|
# @param [String] sid The sid
|
143
143
|
# @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed.
|
@@ -35,10 +35,6 @@ module Twilio
|
|
35
35
|
# Lists InteractionInstance records from the API as a list.
|
36
36
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
37
37
|
# memory before returning.
|
38
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The
|
39
|
-
# inbound_participant_status
|
40
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The
|
41
|
-
# outbound_participant_status
|
42
38
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
43
39
|
# guarantees to never return more than limit. Default is no limit
|
44
40
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -46,23 +42,14 @@ module Twilio
|
|
46
42
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
47
43
|
# efficient page size, i.e. min(limit, 1000)
|
48
44
|
# @return [Array] Array of up to limit results
|
49
|
-
def list(
|
50
|
-
self.stream(
|
51
|
-
inbound_participant_status: inbound_participant_status,
|
52
|
-
outbound_participant_status: outbound_participant_status,
|
53
|
-
limit: limit,
|
54
|
-
page_size: page_size
|
55
|
-
).entries
|
45
|
+
def list(limit: nil, page_size: nil)
|
46
|
+
self.stream(limit: limit, page_size: page_size).entries
|
56
47
|
end
|
57
48
|
|
58
49
|
##
|
59
50
|
# Streams InteractionInstance records from the API as an Enumerable.
|
60
51
|
# This operation lazily loads records as efficiently as possible until the limit
|
61
52
|
# is reached.
|
62
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The
|
63
|
-
# inbound_participant_status
|
64
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The
|
65
|
-
# outbound_participant_status
|
66
53
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
67
54
|
# guarantees to never return more than limit. Default is no limit.
|
68
55
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -70,14 +57,10 @@ module Twilio
|
|
70
57
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
71
58
|
# efficient page size, i.e. min(limit, 1000)
|
72
59
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
73
|
-
def stream(
|
60
|
+
def stream(limit: nil, page_size: nil)
|
74
61
|
limits = @version.read_limits(limit, page_size)
|
75
62
|
|
76
|
-
page = self.page(
|
77
|
-
inbound_participant_status: inbound_participant_status,
|
78
|
-
outbound_participant_status: outbound_participant_status,
|
79
|
-
page_size: limits[:page_size],
|
80
|
-
)
|
63
|
+
page = self.page(page_size: limits[:page_size], )
|
81
64
|
|
82
65
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
83
66
|
end
|
@@ -99,18 +82,12 @@ module Twilio
|
|
99
82
|
##
|
100
83
|
# Retrieve a single page of InteractionInstance records from the API.
|
101
84
|
# Request is executed immediately.
|
102
|
-
# @param [interaction.ResourceStatus] inbound_participant_status The
|
103
|
-
# inbound_participant_status
|
104
|
-
# @param [interaction.ResourceStatus] outbound_participant_status The
|
105
|
-
# outbound_participant_status
|
106
85
|
# @param [String] page_token PageToken provided by the API
|
107
86
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
108
87
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
109
88
|
# @return [Page] Page of InteractionInstance
|
110
|
-
def page(
|
89
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
111
90
|
params = Twilio::Values.of({
|
112
|
-
'InboundParticipantStatus' => inbound_participant_status,
|
113
|
-
'OutboundParticipantStatus' => outbound_participant_status,
|
114
91
|
'PageToken' => page_token,
|
115
92
|
'Page' => page_number,
|
116
93
|
'PageSize' => page_size,
|
@@ -35,7 +35,6 @@ module Twilio
|
|
35
35
|
# Lists ParticipantInstance records from the API as a list.
|
36
36
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
37
37
|
# memory before returning.
|
38
|
-
# @param [String] identifier The identifier
|
39
38
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
40
39
|
# guarantees to never return more than limit. Default is no limit
|
41
40
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -43,15 +42,14 @@ module Twilio
|
|
43
42
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
44
43
|
# efficient page size, i.e. min(limit, 1000)
|
45
44
|
# @return [Array] Array of up to limit results
|
46
|
-
def list(
|
47
|
-
self.stream(
|
45
|
+
def list(limit: nil, page_size: nil)
|
46
|
+
self.stream(limit: limit, page_size: page_size).entries
|
48
47
|
end
|
49
48
|
|
50
49
|
##
|
51
50
|
# Streams ParticipantInstance records from the API as an Enumerable.
|
52
51
|
# This operation lazily loads records as efficiently as possible until the limit
|
53
52
|
# is reached.
|
54
|
-
# @param [String] identifier The identifier
|
55
53
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
56
54
|
# guarantees to never return more than limit. Default is no limit.
|
57
55
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -59,10 +57,10 @@ module Twilio
|
|
59
57
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
60
58
|
# efficient page size, i.e. min(limit, 1000)
|
61
59
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
62
|
-
def stream(
|
60
|
+
def stream(limit: nil, page_size: nil)
|
63
61
|
limits = @version.read_limits(limit, page_size)
|
64
62
|
|
65
|
-
page = self.page(
|
63
|
+
page = self.page(page_size: limits[:page_size], )
|
66
64
|
|
67
65
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
68
66
|
end
|
@@ -84,14 +82,12 @@ module Twilio
|
|
84
82
|
##
|
85
83
|
# Retrieve a single page of ParticipantInstance records from the API.
|
86
84
|
# Request is executed immediately.
|
87
|
-
# @param [String] identifier The identifier
|
88
85
|
# @param [String] page_token PageToken provided by the API
|
89
86
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
90
87
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
91
88
|
# @return [Page] Page of ParticipantInstance
|
92
|
-
def page(
|
89
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
93
90
|
params = Twilio::Values.of({
|
94
|
-
'Identifier' => identifier,
|
95
91
|
'PageToken' => page_token,
|
96
92
|
'Page' => page_number,
|
97
93
|
'PageSize' => page_size,
|
@@ -31,8 +31,6 @@ module Twilio
|
|
31
31
|
# Lists SessionInstance records from the API as a list.
|
32
32
|
# Unlike stream(), this operation is eager and will load `limit` records into
|
33
33
|
# memory before returning.
|
34
|
-
# @param [String] unique_name The unique_name
|
35
|
-
# @param [session.Status] status The status
|
36
34
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
37
35
|
# guarantees to never return more than limit. Default is no limit
|
38
36
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -40,16 +38,14 @@ module Twilio
|
|
40
38
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
41
39
|
# efficient page size, i.e. min(limit, 1000)
|
42
40
|
# @return [Array] Array of up to limit results
|
43
|
-
def list(
|
44
|
-
self.stream(
|
41
|
+
def list(limit: nil, page_size: nil)
|
42
|
+
self.stream(limit: limit, page_size: page_size).entries
|
45
43
|
end
|
46
44
|
|
47
45
|
##
|
48
46
|
# Streams SessionInstance records from the API as an Enumerable.
|
49
47
|
# This operation lazily loads records as efficiently as possible until the limit
|
50
48
|
# is reached.
|
51
|
-
# @param [String] unique_name The unique_name
|
52
|
-
# @param [session.Status] status The status
|
53
49
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
54
50
|
# guarantees to never return more than limit. Default is no limit.
|
55
51
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -57,10 +53,10 @@ module Twilio
|
|
57
53
|
# but a limit is defined, stream() will attempt to read the limit with the most
|
58
54
|
# efficient page size, i.e. min(limit, 1000)
|
59
55
|
# @return [Enumerable] Enumerable that will yield up to limit results
|
60
|
-
def stream(
|
56
|
+
def stream(limit: nil, page_size: nil)
|
61
57
|
limits = @version.read_limits(limit, page_size)
|
62
58
|
|
63
|
-
page = self.page(
|
59
|
+
page = self.page(page_size: limits[:page_size], )
|
64
60
|
|
65
61
|
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
66
62
|
end
|
@@ -82,16 +78,12 @@ module Twilio
|
|
82
78
|
##
|
83
79
|
# Retrieve a single page of SessionInstance records from the API.
|
84
80
|
# Request is executed immediately.
|
85
|
-
# @param [String] unique_name The unique_name
|
86
|
-
# @param [session.Status] status The status
|
87
81
|
# @param [String] page_token PageToken provided by the API
|
88
82
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
89
83
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
90
84
|
# @return [Page] Page of SessionInstance
|
91
|
-
def page(
|
85
|
+
def page(page_token: :unset, page_number: :unset, page_size: :unset)
|
92
86
|
params = Twilio::Values.of({
|
93
|
-
'UniqueName' => unique_name,
|
94
|
-
'Status' => status,
|
95
87
|
'PageToken' => page_token,
|
96
88
|
'Page' => page_number,
|
97
89
|
'PageSize' => page_size,
|