twilio-ruby 5.2.0 → 5.2.1
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +1 -1
- data/CHANGES.md +9 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream/stream_message.rb +150 -0
- data/lib/twilio-ruby/rest/sync/v1/service/sync_stream.rb +401 -0
- data/lib/twilio-ruby/rest/sync/v1/service.rb +33 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +311 -0
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +23 -0
- data/lib/twilio-ruby/twiml/fax_response.rb +40 -0
- data/lib/twilio-ruby/twiml/messaging_response.rb +66 -103
- data/lib/twilio-ruby/twiml/twiml.rb +52 -48
- data/lib/twilio-ruby/twiml/voice_response.rb +385 -769
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/sync/v1/service/sync_stream/stream_message_spec.rb +47 -0
- data/spec/integration/sync/v1/service/sync_stream_spec.rb +201 -0
- data/spec/integration/sync/v1/service_spec.rb +8 -4
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +85 -0
- data/spec/integration/wireless/v1/sim_spec.rb +3 -0
- data/spec/twiml/messaging_response_spec.rb +6 -6
- data/spec/twiml/voice_response_spec.rb +3 -3
- metadata +13 -3
@@ -202,6 +202,7 @@ module Twilio
|
|
202
202
|
@documents = nil
|
203
203
|
@sync_lists = nil
|
204
204
|
@sync_maps = nil
|
205
|
+
@sync_streams = nil
|
205
206
|
end
|
206
207
|
|
207
208
|
##
|
@@ -333,6 +334,31 @@ module Twilio
|
|
333
334
|
@sync_maps
|
334
335
|
end
|
335
336
|
|
337
|
+
##
|
338
|
+
# Access the sync_streams
|
339
|
+
# @return [SyncStreamList]
|
340
|
+
# @return [SyncStreamContext] if sid was passed.
|
341
|
+
def sync_streams(sid=:unset)
|
342
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
343
|
+
|
344
|
+
if sid != :unset
|
345
|
+
return SyncStreamContext.new(
|
346
|
+
@version,
|
347
|
+
@solution[:sid],
|
348
|
+
sid,
|
349
|
+
)
|
350
|
+
end
|
351
|
+
|
352
|
+
unless @sync_streams
|
353
|
+
@sync_streams = SyncStreamList.new(
|
354
|
+
@version,
|
355
|
+
service_sid: @solution[:sid],
|
356
|
+
)
|
357
|
+
end
|
358
|
+
|
359
|
+
@sync_streams
|
360
|
+
end
|
361
|
+
|
336
362
|
##
|
337
363
|
# Provide a user friendly representation
|
338
364
|
def to_s
|
@@ -506,6 +532,13 @@ module Twilio
|
|
506
532
|
context.sync_maps
|
507
533
|
end
|
508
534
|
|
535
|
+
##
|
536
|
+
# Access the sync_streams
|
537
|
+
# @return [sync_streams] sync_streams
|
538
|
+
def sync_streams
|
539
|
+
context.sync_streams
|
540
|
+
end
|
541
|
+
|
509
542
|
##
|
510
543
|
# Provide a user friendly representation
|
511
544
|
def to_s
|
@@ -0,0 +1,311 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module REST
|
9
|
+
class Wireless < Domain
|
10
|
+
class V1 < Version
|
11
|
+
class SimContext < InstanceContext
|
12
|
+
##
|
13
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
14
|
+
class DataSessionList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the DataSessionList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] sim_sid The sim_sid
|
19
|
+
# @return [DataSessionList] DataSessionList
|
20
|
+
def initialize(version, sim_sid: nil)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {
|
25
|
+
sim_sid: sim_sid
|
26
|
+
}
|
27
|
+
@uri = "/Sims/#{@solution[:sim_sid]}/DataSessions"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Lists DataSessionInstance 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 [Time] end_ The end
|
35
|
+
# @param [Time] start The start
|
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(end_: :unset, start: :unset, limit: nil, page_size: nil)
|
44
|
+
self.stream(
|
45
|
+
end_: end_,
|
46
|
+
start: start,
|
47
|
+
limit: limit,
|
48
|
+
page_size: page_size
|
49
|
+
).entries
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# Streams DataSessionInstance records from the API as an Enumerable.
|
54
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
55
|
+
# is reached.
|
56
|
+
# @param [Time] end_ The end
|
57
|
+
# @param [Time] start The start
|
58
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
59
|
+
# guarantees to never return more than limit. Default is no limit.
|
60
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
61
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
62
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
63
|
+
# efficient page size, i.e. min(limit, 1000)
|
64
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
65
|
+
def stream(end_: :unset, start: :unset, limit: nil, page_size: nil)
|
66
|
+
limits = @version.read_limits(limit, page_size)
|
67
|
+
|
68
|
+
page = self.page(
|
69
|
+
end_: end_,
|
70
|
+
start: start,
|
71
|
+
page_size: limits[:page_size],
|
72
|
+
)
|
73
|
+
|
74
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# When passed a block, yields DataSessionInstance records from the API.
|
79
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
80
|
+
# is reached.
|
81
|
+
def each
|
82
|
+
limits = @version.read_limits
|
83
|
+
|
84
|
+
page = self.page(
|
85
|
+
page_size: limits[:page_size],
|
86
|
+
)
|
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 DataSessionInstance records from the API.
|
95
|
+
# Request is executed immediately.
|
96
|
+
# @param [Time] end_ The end
|
97
|
+
# @param [Time] start The start
|
98
|
+
# @param [String] page_token PageToken provided by the API
|
99
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
100
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
101
|
+
# @return [Page] Page of DataSessionInstance
|
102
|
+
def page(end_: :unset, start: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
103
|
+
params = Twilio::Values.of({
|
104
|
+
'End' => Twilio.serialize_iso8601_datetime(end_),
|
105
|
+
'Start' => Twilio.serialize_iso8601_datetime(start),
|
106
|
+
'PageToken' => page_token,
|
107
|
+
'Page' => page_number,
|
108
|
+
'PageSize' => page_size,
|
109
|
+
})
|
110
|
+
response = @version.page(
|
111
|
+
'GET',
|
112
|
+
@uri,
|
113
|
+
params
|
114
|
+
)
|
115
|
+
DataSessionPage.new(@version, response, @solution)
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Retrieve a single page of DataSessionInstance records from the API.
|
120
|
+
# Request is executed immediately.
|
121
|
+
# @param [String] target_url API-generated URL for the requested results page
|
122
|
+
# @return [Page] Page of DataSessionInstance
|
123
|
+
def get_page(target_url)
|
124
|
+
response = @version.domain.request(
|
125
|
+
'GET',
|
126
|
+
target_url
|
127
|
+
)
|
128
|
+
DataSessionPage.new(@version, response, @solution)
|
129
|
+
end
|
130
|
+
|
131
|
+
##
|
132
|
+
# Provide a user friendly representation
|
133
|
+
def to_s
|
134
|
+
'#<Twilio.Wireless.V1.DataSessionList>'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
##
|
139
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
140
|
+
class DataSessionPage < Page
|
141
|
+
##
|
142
|
+
# Initialize the DataSessionPage
|
143
|
+
# @param [Version] version Version that contains the resource
|
144
|
+
# @param [Response] response Response from the API
|
145
|
+
# @param [Hash] solution Path solution for the resource
|
146
|
+
# @return [DataSessionPage] DataSessionPage
|
147
|
+
def initialize(version, response, solution)
|
148
|
+
super(version, response)
|
149
|
+
|
150
|
+
# Path Solution
|
151
|
+
@solution = solution
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Build an instance of DataSessionInstance
|
156
|
+
# @param [Hash] payload Payload response from the API
|
157
|
+
# @return [DataSessionInstance] DataSessionInstance
|
158
|
+
def get_instance(payload)
|
159
|
+
DataSessionInstance.new(
|
160
|
+
@version,
|
161
|
+
payload,
|
162
|
+
sim_sid: @solution[:sim_sid],
|
163
|
+
)
|
164
|
+
end
|
165
|
+
|
166
|
+
##
|
167
|
+
# Provide a user friendly representation
|
168
|
+
def to_s
|
169
|
+
'<Twilio.Wireless.V1.DataSessionPage>'
|
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 DataSessionInstance < InstanceResource
|
176
|
+
##
|
177
|
+
# Initialize the DataSessionInstance
|
178
|
+
# @param [Version] version Version that contains the resource
|
179
|
+
# @param [Hash] payload payload that contains response from Twilio
|
180
|
+
# @param [String] sim_sid The sim_sid
|
181
|
+
# @return [DataSessionInstance] DataSessionInstance
|
182
|
+
def initialize(version, payload, sim_sid: nil)
|
183
|
+
super(version)
|
184
|
+
|
185
|
+
# Marshaled Properties
|
186
|
+
@properties = {
|
187
|
+
'sid' => payload['sid'],
|
188
|
+
'sim_sid' => payload['sim_sid'],
|
189
|
+
'account_sid' => payload['account_sid'],
|
190
|
+
'radio_link' => payload['radio_link'],
|
191
|
+
'operator_mcc' => payload['operator_mcc'].to_i,
|
192
|
+
'operator_mnc' => payload['operator_mnc'].to_i,
|
193
|
+
'operator_country' => payload['operator_country'],
|
194
|
+
'operator_name' => payload['operator_name'],
|
195
|
+
'cell_id' => payload['cell_id'],
|
196
|
+
'cell_location_estimate' => payload['cell_location_estimate'],
|
197
|
+
'packets_uploaded' => payload['packets_uploaded'].to_i,
|
198
|
+
'packets_downloaded' => payload['packets_downloaded'].to_i,
|
199
|
+
'last_updated' => Twilio.deserialize_iso8601_datetime(payload['last_updated']),
|
200
|
+
'start' => Twilio.deserialize_iso8601_datetime(payload['start']),
|
201
|
+
'end_' => Twilio.deserialize_iso8601_datetime(payload['end']),
|
202
|
+
}
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# @return [String] The sid
|
207
|
+
def sid
|
208
|
+
@properties['sid']
|
209
|
+
end
|
210
|
+
|
211
|
+
##
|
212
|
+
# @return [String] The sim_sid
|
213
|
+
def sim_sid
|
214
|
+
@properties['sim_sid']
|
215
|
+
end
|
216
|
+
|
217
|
+
##
|
218
|
+
# @return [String] The account_sid
|
219
|
+
def account_sid
|
220
|
+
@properties['account_sid']
|
221
|
+
end
|
222
|
+
|
223
|
+
##
|
224
|
+
# @return [String] The radio_link
|
225
|
+
def radio_link
|
226
|
+
@properties['radio_link']
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# @return [String] The operator_mcc
|
231
|
+
def operator_mcc
|
232
|
+
@properties['operator_mcc']
|
233
|
+
end
|
234
|
+
|
235
|
+
##
|
236
|
+
# @return [String] The operator_mnc
|
237
|
+
def operator_mnc
|
238
|
+
@properties['operator_mnc']
|
239
|
+
end
|
240
|
+
|
241
|
+
##
|
242
|
+
# @return [String] The operator_country
|
243
|
+
def operator_country
|
244
|
+
@properties['operator_country']
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# @return [String] The operator_name
|
249
|
+
def operator_name
|
250
|
+
@properties['operator_name']
|
251
|
+
end
|
252
|
+
|
253
|
+
##
|
254
|
+
# @return [String] The cell_id
|
255
|
+
def cell_id
|
256
|
+
@properties['cell_id']
|
257
|
+
end
|
258
|
+
|
259
|
+
##
|
260
|
+
# @return [Hash] The cell_location_estimate
|
261
|
+
def cell_location_estimate
|
262
|
+
@properties['cell_location_estimate']
|
263
|
+
end
|
264
|
+
|
265
|
+
##
|
266
|
+
# @return [String] The packets_uploaded
|
267
|
+
def packets_uploaded
|
268
|
+
@properties['packets_uploaded']
|
269
|
+
end
|
270
|
+
|
271
|
+
##
|
272
|
+
# @return [String] The packets_downloaded
|
273
|
+
def packets_downloaded
|
274
|
+
@properties['packets_downloaded']
|
275
|
+
end
|
276
|
+
|
277
|
+
##
|
278
|
+
# @return [Time] The last_updated
|
279
|
+
def last_updated
|
280
|
+
@properties['last_updated']
|
281
|
+
end
|
282
|
+
|
283
|
+
##
|
284
|
+
# @return [Time] The start
|
285
|
+
def start
|
286
|
+
@properties['start']
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# @return [Time] The end
|
291
|
+
def end_
|
292
|
+
@properties['end_']
|
293
|
+
end
|
294
|
+
|
295
|
+
##
|
296
|
+
# Provide a user friendly representation
|
297
|
+
def to_s
|
298
|
+
"<Twilio.Wireless.V1.DataSessionInstance>"
|
299
|
+
end
|
300
|
+
|
301
|
+
##
|
302
|
+
# Provide a detailed, user friendly representation
|
303
|
+
def inspect
|
304
|
+
"<Twilio.Wireless.V1.DataSessionInstance>"
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
@@ -202,6 +202,7 @@ module Twilio
|
|
202
202
|
|
203
203
|
# Dependents
|
204
204
|
@usage_records = nil
|
205
|
+
@data_sessions = nil
|
205
206
|
end
|
206
207
|
|
207
208
|
##
|
@@ -290,6 +291,21 @@ module Twilio
|
|
290
291
|
@usage_records
|
291
292
|
end
|
292
293
|
|
294
|
+
##
|
295
|
+
# Access the data_sessions
|
296
|
+
# @return [DataSessionList]
|
297
|
+
# @return [DataSessionContext]
|
298
|
+
def data_sessions
|
299
|
+
unless @data_sessions
|
300
|
+
@data_sessions = DataSessionList.new(
|
301
|
+
@version,
|
302
|
+
sim_sid: @solution[:sid],
|
303
|
+
)
|
304
|
+
end
|
305
|
+
|
306
|
+
@data_sessions
|
307
|
+
end
|
308
|
+
|
293
309
|
##
|
294
310
|
# Provide a user friendly representation
|
295
311
|
def to_s
|
@@ -543,6 +559,13 @@ module Twilio
|
|
543
559
|
context.usage_records
|
544
560
|
end
|
545
561
|
|
562
|
+
##
|
563
|
+
# Access the data_sessions
|
564
|
+
# @return [data_sessions] data_sessions
|
565
|
+
def data_sessions
|
566
|
+
context.data_sessions
|
567
|
+
end
|
568
|
+
|
546
569
|
##
|
547
570
|
# Provide a user friendly representation
|
548
571
|
def to_s
|
@@ -0,0 +1,40 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
|
7
|
+
module Twilio
|
8
|
+
module TwiML
|
9
|
+
##
|
10
|
+
# <Response> TwiML for Faxes
|
11
|
+
class FaxResponse < TwiML
|
12
|
+
def initialize(**keyword_args)
|
13
|
+
super(**keyword_args)
|
14
|
+
@name = 'Response'
|
15
|
+
|
16
|
+
yield(self) if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Create a new <Receive> element
|
21
|
+
# action:: Receive action URL
|
22
|
+
# method:: Receive action URL method
|
23
|
+
# keyword_args:: additional attributes
|
24
|
+
def receive(action: nil, method: nil, **keyword_args)
|
25
|
+
append(Receive.new(action: action, method: method, **keyword_args))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# <Receive> TwiML Verb
|
31
|
+
class Receive < TwiML
|
32
|
+
def initialize(**keyword_args)
|
33
|
+
super(**keyword_args)
|
34
|
+
@name = 'Receive'
|
35
|
+
|
36
|
+
yield(self) if block_given?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|