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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d533d87716914f7de3176c3a076a57f724bddde
4
- data.tar.gz: 19f83ab1668c792dd6b392e2d5e22c3d936636c5
3
+ metadata.gz: 2af2bf820a3fb5e86dac192777b9fa9033838f58
4
+ data.tar.gz: 9c2a731cf45ccc73b532590f8c557facb6831cce
5
5
  SHA512:
6
- metadata.gz: 07c6a28ba0ac34f19fb1f0a9eaf69095f459a9bcc09f5c825aac523bdf0e41784458e559bdbd1cfcb0b99374ea63eecb1848f8cf8c65601bc24b7d9f7136163f
7
- data.tar.gz: ed1f51c729bd7b1fffe60f2c23fc9e4307826dbd757a7cdfc1bbeffb5c02f8003e50dbb65142dc0207fcebd4dafeb87f2f41731ff7caae4120b5b1c1851216ce
6
+ metadata.gz: 3ea412fd75b56cd6c192b945a8cb24539137cab3c1d0efe1a6a9d4d503e3b02f6b06b2a7d1905f6d1d1375209b06fe6c9cd6c12a6c886f6bd2942d4da1d6afaf
7
+ data.tar.gz: 3b5d3ad04265157711e657703e3768ee1140d58b8a927a3f6b152a16881a86308a95a3dbe1ef85d4e85a3ce1e17e9d728150fdf2cf8d711e99af02bbfe28d5d3
data/.rubocop.yml CHANGED
@@ -6,6 +6,7 @@ AllCops:
6
6
  - 'lib/twilio-ruby/rest/**/*'
7
7
  - 'spec/integration/**/*'
8
8
  - 'lib/twilio-ruby/version.rb'
9
+ - 'lib/twilio-ruby/twiml/**/*'
9
10
 
10
11
  Metrics/LineLength:
11
12
  Max: 120
data/.travis.yml CHANGED
@@ -7,7 +7,7 @@ rvm:
7
7
  - 2.4.0
8
8
  - 2.3.0
9
9
  - 2.2.0
10
- - 2.1.0
10
+ - 2.1
11
11
  - 2.0.0
12
12
  matrix:
13
13
  fast_finish: true
data/CHANGES.md CHANGED
@@ -1,6 +1,15 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2017-09-01] Version 5.2.1
5
+ ---------------------------
6
+ **Sync**
7
+ - Add support for Streams
8
+
9
+ **Wireless**
10
+ - Added DataSessions sub-resource to Sims.
11
+
12
+
4
13
  [2017-08-25] Version 5.2.0
5
14
  ---------------------------
6
15
  **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.2.0'
30
+ gem 'twilio-ruby', '~> 5.2.1'
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.2.0
36
+ gem install twilio-ruby -v 5.2.1
37
37
  ```
38
38
 
39
39
  To build and install the development branch yourself from the latest source:
@@ -0,0 +1,150 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Sync < Domain
10
+ class V1 < Version
11
+ class ServiceContext < InstanceContext
12
+ class SyncStreamContext < InstanceContext
13
+ ##
14
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
+ class StreamMessageList < ListResource
16
+ ##
17
+ # Initialize the StreamMessageList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] service_sid The unique SID identifier of the Service Instance.
20
+ # @param [String] stream_sid The unique 34-character SID identifier of the Stream.
21
+ # @return [StreamMessageList] StreamMessageList
22
+ def initialize(version, service_sid: nil, stream_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {
27
+ service_sid: service_sid,
28
+ stream_sid: stream_sid
29
+ }
30
+ @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:stream_sid]}/Messages"
31
+ end
32
+
33
+ ##
34
+ # Retrieve a single page of StreamMessageInstance records from the API.
35
+ # Request is executed immediately.
36
+ # @param [Hash] data The body of the Stream Message. Arbitrary JSON object,
37
+ # maximum size 4KB.
38
+ # @return [StreamMessageInstance] Newly created StreamMessageInstance
39
+ def create(data: nil)
40
+ data = Twilio::Values.of({
41
+ 'Data' => Twilio.serialize_object(data),
42
+ })
43
+
44
+ payload = @version.create(
45
+ 'POST',
46
+ @uri,
47
+ data: data
48
+ )
49
+
50
+ StreamMessageInstance.new(
51
+ @version,
52
+ payload,
53
+ service_sid: @solution[:service_sid],
54
+ stream_sid: @solution[:stream_sid],
55
+ )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '#<Twilio.Sync.V1.StreamMessageList>'
62
+ end
63
+ end
64
+
65
+ ##
66
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
67
+ class StreamMessagePage < Page
68
+ ##
69
+ # Initialize the StreamMessagePage
70
+ # @param [Version] version Version that contains the resource
71
+ # @param [Response] response Response from the API
72
+ # @param [Hash] solution Path solution for the resource
73
+ # @return [StreamMessagePage] StreamMessagePage
74
+ def initialize(version, response, solution)
75
+ super(version, response)
76
+
77
+ # Path Solution
78
+ @solution = solution
79
+ end
80
+
81
+ ##
82
+ # Build an instance of StreamMessageInstance
83
+ # @param [Hash] payload Payload response from the API
84
+ # @return [StreamMessageInstance] StreamMessageInstance
85
+ def get_instance(payload)
86
+ StreamMessageInstance.new(
87
+ @version,
88
+ payload,
89
+ service_sid: @solution[:service_sid],
90
+ stream_sid: @solution[:stream_sid],
91
+ )
92
+ end
93
+
94
+ ##
95
+ # Provide a user friendly representation
96
+ def to_s
97
+ '<Twilio.Sync.V1.StreamMessagePage>'
98
+ end
99
+ end
100
+
101
+ ##
102
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
103
+ class StreamMessageInstance < InstanceResource
104
+ ##
105
+ # Initialize the StreamMessageInstance
106
+ # @param [Version] version Version that contains the resource
107
+ # @param [Hash] payload payload that contains response from Twilio
108
+ # @param [String] service_sid The unique SID identifier of the Service Instance.
109
+ # @param [String] stream_sid The unique 34-character SID identifier of the Stream.
110
+ # @return [StreamMessageInstance] StreamMessageInstance
111
+ def initialize(version, payload, service_sid: nil, stream_sid: nil)
112
+ super(version)
113
+
114
+ # Marshaled Properties
115
+ @properties = {
116
+ 'sid' => payload['sid'],
117
+ 'data' => payload['data'],
118
+ }
119
+ end
120
+
121
+ ##
122
+ # @return [String] Stream Message SID.
123
+ def sid
124
+ @properties['sid']
125
+ end
126
+
127
+ ##
128
+ # @return [Hash] Stream Message body.
129
+ def data
130
+ @properties['data']
131
+ end
132
+
133
+ ##
134
+ # Provide a user friendly representation
135
+ def to_s
136
+ "<Twilio.Sync.V1.StreamMessageInstance>"
137
+ end
138
+
139
+ ##
140
+ # Provide a detailed, user friendly representation
141
+ def inspect
142
+ "<Twilio.Sync.V1.StreamMessageInstance>"
143
+ end
144
+ end
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,401 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Sync < Domain
10
+ class V1 < Version
11
+ class ServiceContext < InstanceContext
12
+ ##
13
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
14
+ class SyncStreamList < ListResource
15
+ ##
16
+ # Initialize the SyncStreamList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] service_sid The unique SID identifier of the Service Instance.
19
+ # @return [SyncStreamList] SyncStreamList
20
+ def initialize(version, service_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ service_sid: service_sid
26
+ }
27
+ @uri = "/Services/#{@solution[:service_sid]}/Streams"
28
+ end
29
+
30
+ ##
31
+ # Retrieve a single page of SyncStreamInstance records from the API.
32
+ # Request is executed immediately.
33
+ # @param [String] unique_name The unique and addressable name of this Stream.
34
+ # Optional, up to 256 characters long.
35
+ # @return [SyncStreamInstance] Newly created SyncStreamInstance
36
+ def create(unique_name: :unset)
37
+ data = Twilio::Values.of({
38
+ 'UniqueName' => unique_name,
39
+ })
40
+
41
+ payload = @version.create(
42
+ 'POST',
43
+ @uri,
44
+ data: data
45
+ )
46
+
47
+ SyncStreamInstance.new(
48
+ @version,
49
+ payload,
50
+ service_sid: @solution[:service_sid],
51
+ )
52
+ end
53
+
54
+ ##
55
+ # Lists SyncStreamInstance records from the API as a list.
56
+ # Unlike stream(), this operation is eager and will load `limit` records into
57
+ # memory before returning.
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 [Array] Array of up to limit results
65
+ def list(limit: nil, page_size: nil)
66
+ self.stream(
67
+ limit: limit,
68
+ page_size: page_size
69
+ ).entries
70
+ end
71
+
72
+ ##
73
+ # Streams SyncStreamInstance records from the API as an Enumerable.
74
+ # This operation lazily loads records as efficiently as possible until the limit
75
+ # is reached.
76
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
77
+ # guarantees to never return more than limit. Default is no limit.
78
+ # @param [Integer] page_size Number of records to fetch per request, when
79
+ # not set will use the default value of 50 records. If no page_size is defined
80
+ # but a limit is defined, stream() will attempt to read the limit with the most
81
+ # efficient page size, i.e. min(limit, 1000)
82
+ # @return [Enumerable] Enumerable that will yield up to limit results
83
+ def stream(limit: nil, page_size: nil)
84
+ limits = @version.read_limits(limit, page_size)
85
+
86
+ page = self.page(
87
+ page_size: limits[:page_size],
88
+ )
89
+
90
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
91
+ end
92
+
93
+ ##
94
+ # When passed a block, yields SyncStreamInstance records from the API.
95
+ # This operation lazily loads records as efficiently as possible until the limit
96
+ # is reached.
97
+ def each
98
+ limits = @version.read_limits
99
+
100
+ page = self.page(
101
+ page_size: limits[:page_size],
102
+ )
103
+
104
+ @version.stream(page,
105
+ limit: limits[:limit],
106
+ page_limit: limits[:page_limit]).each {|x| yield x}
107
+ end
108
+
109
+ ##
110
+ # Retrieve a single page of SyncStreamInstance records from the API.
111
+ # Request is executed immediately.
112
+ # @param [String] page_token PageToken provided by the API
113
+ # @param [Integer] page_number Page Number, this value is simply for client state
114
+ # @param [Integer] page_size Number of records to return, defaults to 50
115
+ # @return [Page] Page of SyncStreamInstance
116
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
117
+ params = Twilio::Values.of({
118
+ 'PageToken' => page_token,
119
+ 'Page' => page_number,
120
+ 'PageSize' => page_size,
121
+ })
122
+ response = @version.page(
123
+ 'GET',
124
+ @uri,
125
+ params
126
+ )
127
+ SyncStreamPage.new(@version, response, @solution)
128
+ end
129
+
130
+ ##
131
+ # Retrieve a single page of SyncStreamInstance records from the API.
132
+ # Request is executed immediately.
133
+ # @param [String] target_url API-generated URL for the requested results page
134
+ # @return [Page] Page of SyncStreamInstance
135
+ def get_page(target_url)
136
+ response = @version.domain.request(
137
+ 'GET',
138
+ target_url
139
+ )
140
+ SyncStreamPage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Provide a user friendly representation
145
+ def to_s
146
+ '#<Twilio.Sync.V1.SyncStreamList>'
147
+ end
148
+ end
149
+
150
+ ##
151
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
152
+ class SyncStreamPage < Page
153
+ ##
154
+ # Initialize the SyncStreamPage
155
+ # @param [Version] version Version that contains the resource
156
+ # @param [Response] response Response from the API
157
+ # @param [Hash] solution Path solution for the resource
158
+ # @return [SyncStreamPage] SyncStreamPage
159
+ def initialize(version, response, solution)
160
+ super(version, response)
161
+
162
+ # Path Solution
163
+ @solution = solution
164
+ end
165
+
166
+ ##
167
+ # Build an instance of SyncStreamInstance
168
+ # @param [Hash] payload Payload response from the API
169
+ # @return [SyncStreamInstance] SyncStreamInstance
170
+ def get_instance(payload)
171
+ SyncStreamInstance.new(
172
+ @version,
173
+ payload,
174
+ service_sid: @solution[:service_sid],
175
+ )
176
+ end
177
+
178
+ ##
179
+ # Provide a user friendly representation
180
+ def to_s
181
+ '<Twilio.Sync.V1.SyncStreamPage>'
182
+ end
183
+ end
184
+
185
+ ##
186
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
187
+ class SyncStreamContext < InstanceContext
188
+ ##
189
+ # Initialize the SyncStreamContext
190
+ # @param [Version] version Version that contains the resource
191
+ # @param [String] service_sid The service_sid
192
+ # @param [String] sid Identifier of the Stream. Either a SID or a unique name.
193
+ # @return [SyncStreamContext] SyncStreamContext
194
+ def initialize(version, service_sid, sid)
195
+ super(version)
196
+
197
+ # Path Solution
198
+ @solution = {
199
+ service_sid: service_sid,
200
+ sid: sid,
201
+ }
202
+ @uri = "/Services/#{@solution[:service_sid]}/Streams/#{@solution[:sid]}"
203
+
204
+ # Dependents
205
+ @stream_messages = nil
206
+ end
207
+
208
+ ##
209
+ # Fetch a SyncStreamInstance
210
+ # @return [SyncStreamInstance] Fetched SyncStreamInstance
211
+ def fetch
212
+ params = Twilio::Values.of({})
213
+
214
+ payload = @version.fetch(
215
+ 'GET',
216
+ @uri,
217
+ params,
218
+ )
219
+
220
+ SyncStreamInstance.new(
221
+ @version,
222
+ payload,
223
+ service_sid: @solution[:service_sid],
224
+ sid: @solution[:sid],
225
+ )
226
+ end
227
+
228
+ ##
229
+ # Deletes the SyncStreamInstance
230
+ # @return [Boolean] true if delete succeeds, true otherwise
231
+ def delete
232
+ @version.delete('delete', @uri)
233
+ end
234
+
235
+ ##
236
+ # Access the stream_messages
237
+ # @return [StreamMessageList]
238
+ # @return [StreamMessageContext]
239
+ def stream_messages
240
+ unless @stream_messages
241
+ @stream_messages = StreamMessageList.new(
242
+ @version,
243
+ service_sid: @solution[:service_sid],
244
+ stream_sid: @solution[:sid],
245
+ )
246
+ end
247
+
248
+ @stream_messages
249
+ end
250
+
251
+ ##
252
+ # Provide a user friendly representation
253
+ def to_s
254
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
255
+ "#<Twilio.Sync.V1.SyncStreamContext #{context}>"
256
+ end
257
+ end
258
+
259
+ ##
260
+ # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
261
+ class SyncStreamInstance < InstanceResource
262
+ ##
263
+ # Initialize the SyncStreamInstance
264
+ # @param [Version] version Version that contains the resource
265
+ # @param [Hash] payload payload that contains response from Twilio
266
+ # @param [String] service_sid The unique SID identifier of the Service Instance.
267
+ # @param [String] sid Identifier of the Stream. Either a SID or a unique name.
268
+ # @return [SyncStreamInstance] SyncStreamInstance
269
+ def initialize(version, payload, service_sid: nil, sid: nil)
270
+ super(version)
271
+
272
+ # Marshaled Properties
273
+ @properties = {
274
+ 'sid' => payload['sid'],
275
+ 'unique_name' => payload['unique_name'],
276
+ 'account_sid' => payload['account_sid'],
277
+ 'service_sid' => payload['service_sid'],
278
+ 'url' => payload['url'],
279
+ 'links' => payload['links'],
280
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
281
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
282
+ 'created_by' => payload['created_by'],
283
+ }
284
+
285
+ # Context
286
+ @instance_context = nil
287
+ @params = {
288
+ 'service_sid' => service_sid,
289
+ 'sid' => sid || @properties['sid'],
290
+ }
291
+ end
292
+
293
+ ##
294
+ # Generate an instance context for the instance, the context is capable of
295
+ # performing various actions. All instance actions are proxied to the context
296
+ # @return [SyncStreamContext] SyncStreamContext for this SyncStreamInstance
297
+ def context
298
+ unless @instance_context
299
+ @instance_context = SyncStreamContext.new(
300
+ @version,
301
+ @params['service_sid'],
302
+ @params['sid'],
303
+ )
304
+ end
305
+ @instance_context
306
+ end
307
+
308
+ ##
309
+ # @return [String] Stream SID.
310
+ def sid
311
+ @properties['sid']
312
+ end
313
+
314
+ ##
315
+ # @return [String] Stream unique name.
316
+ def unique_name
317
+ @properties['unique_name']
318
+ end
319
+
320
+ ##
321
+ # @return [String] Twilio Account SID.
322
+ def account_sid
323
+ @properties['account_sid']
324
+ end
325
+
326
+ ##
327
+ # @return [String] Service Instance SID.
328
+ def service_sid
329
+ @properties['service_sid']
330
+ end
331
+
332
+ ##
333
+ # @return [String] URL of this Stream.
334
+ def url
335
+ @properties['url']
336
+ end
337
+
338
+ ##
339
+ # @return [String] Nested resource URLs.
340
+ def links
341
+ @properties['links']
342
+ end
343
+
344
+ ##
345
+ # @return [Time] The date this Stream was created.
346
+ def date_created
347
+ @properties['date_created']
348
+ end
349
+
350
+ ##
351
+ # @return [Time] The date this Stream was updated.
352
+ def date_updated
353
+ @properties['date_updated']
354
+ end
355
+
356
+ ##
357
+ # @return [String] Identity of the Stream creator.
358
+ def created_by
359
+ @properties['created_by']
360
+ end
361
+
362
+ ##
363
+ # Fetch a SyncStreamInstance
364
+ # @return [SyncStreamInstance] Fetched SyncStreamInstance
365
+ def fetch
366
+ context.fetch
367
+ end
368
+
369
+ ##
370
+ # Deletes the SyncStreamInstance
371
+ # @return [Boolean] true if delete succeeds, true otherwise
372
+ def delete
373
+ context.delete
374
+ end
375
+
376
+ ##
377
+ # Access the stream_messages
378
+ # @return [stream_messages] stream_messages
379
+ def stream_messages
380
+ context.stream_messages
381
+ end
382
+
383
+ ##
384
+ # Provide a user friendly representation
385
+ def to_s
386
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
387
+ "<Twilio.Sync.V1.SyncStreamInstance #{values}>"
388
+ end
389
+
390
+ ##
391
+ # Provide a detailed, user friendly representation
392
+ def inspect
393
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
394
+ "<Twilio.Sync.V1.SyncStreamInstance #{values}>"
395
+ end
396
+ end
397
+ end
398
+ end
399
+ end
400
+ end
401
+ end