twilio-ruby 5.0.0.rc16 → 5.0.0.rc17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS.md +1 -0
  3. data/CHANGES.md +1 -1
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/jwt/access_token.rb +23 -1
  6. data/lib/twilio-ruby/rest/api.rb +2 -2
  7. data/lib/twilio-ruby/rest/api/v2010.rb +2 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account.rb +19 -11
  9. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +29 -5
  10. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +5 -5
  11. data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +25 -0
  12. data/lib/twilio-ruby/rest/api/v2010/account/short_code.rb +406 -0
  13. data/lib/twilio-ruby/rest/api/v2010/account/sip/credential_list/credential.rb +2 -6
  14. data/lib/twilio-ruby/rest/{notifications.rb → chat.rb} +6 -6
  15. data/lib/twilio-ruby/rest/{notifications → chat}/v1.rb +3 -3
  16. data/lib/twilio-ruby/rest/{notifications → chat}/v1/credential.rb +5 -5
  17. data/lib/twilio-ruby/rest/chat/v1/service.rb +501 -0
  18. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +468 -0
  19. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +351 -0
  20. data/lib/twilio-ruby/rest/{api/v2010/account/sms/sms_message.rb → chat/v1/service/channel/message.rb} +120 -168
  21. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +373 -0
  22. data/lib/twilio-ruby/rest/chat/v1/service/user.rb +378 -0
  23. data/lib/twilio-ruby/rest/client.rb +19 -8
  24. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +3 -1
  25. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -6
  26. data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +5 -1
  27. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -0
  28. data/lib/twilio-ruby/rest/notify.rb +44 -0
  29. data/lib/twilio-ruby/rest/notify/v1.rb +44 -0
  30. data/lib/twilio-ruby/rest/notify/v1/credential.rb +375 -0
  31. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service.rb +5 -5
  32. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/binding.rb +5 -5
  33. data/lib/twilio-ruby/rest/{notifications → notify}/v1/service/notification.rb +4 -4
  34. data/lib/twilio-ruby/rest/preview.rb +11 -0
  35. data/lib/twilio-ruby/rest/preview/sync.rb +35 -0
  36. data/lib/twilio-ruby/rest/preview/sync/service.rb +458 -0
  37. data/lib/twilio-ruby/rest/preview/sync/service/document.rb +376 -0
  38. data/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +375 -0
  39. data/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +409 -0
  40. data/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +375 -0
  41. data/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +411 -0
  42. data/lib/twilio-ruby/rest/preview/wireless/device.rb +6 -2
  43. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +55 -3
  44. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +29 -6
  45. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +294 -0
  46. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +32 -0
  47. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb +374 -0
  48. data/lib/twilio-ruby/version.rb +1 -1
  49. data/spec/integration/api/v2010/account/conference/participant_spec.rb +6 -6
  50. data/spec/integration/api/v2010/account/recording_spec.rb +10 -1
  51. data/spec/integration/api/v2010/account/{sms/short_code_spec.rb → short_code_spec.rb} +0 -7
  52. data/spec/integration/api/v2010/account/sip/credential_list/credential_spec.rb +3 -7
  53. data/spec/integration/chat/v1/credential_spec.rb +223 -0
  54. data/spec/integration/chat/v1/service/channel/member_spec.rb +213 -0
  55. data/spec/integration/chat/v1/service/channel/message_spec.rb +100 -0
  56. data/spec/integration/chat/v1/service/channel_spec.rb +259 -0
  57. data/spec/integration/chat/v1/service/role_spec.rb +263 -0
  58. data/spec/integration/chat/v1/service/user_spec.rb +242 -0
  59. data/spec/integration/chat/v1/service_spec.rb +263 -0
  60. data/spec/integration/ip_messaging/v1/service/role_spec.rb +2 -3
  61. data/spec/integration/ip_messaging/v1/service/user_spec.rb +2 -3
  62. data/spec/integration/lookups/v1/phone_number_spec.rb +5 -0
  63. data/spec/integration/{notifications → notify}/v1/credential_spec.rb +24 -24
  64. data/spec/integration/{notifications → notify}/v1/service/binding_spec.rb +29 -29
  65. data/spec/integration/{notifications → notify}/v1/service/notification_spec.rb +5 -5
  66. data/spec/integration/{notifications → notify}/v1/service_spec.rb +32 -32
  67. data/spec/integration/preview/sync/service/document_spec.rb +92 -0
  68. data/spec/integration/preview/sync/service/sync_list/sync_list_item_spec.rb +100 -0
  69. data/spec/integration/preview/sync/service/sync_list_spec.rb +73 -0
  70. data/spec/integration/preview/sync/service/sync_map/sync_map_item_spec.rb +101 -0
  71. data/spec/integration/preview/sync/service/sync_map_spec.rb +73 -0
  72. data/spec/integration/preview/sync/service_spec.rb +84 -0
  73. data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +127 -0
  74. data/spec/integration/taskrouter/v1/workspace/task_spec.rb +8 -0
  75. data/spec/integration/taskrouter/v1/workspace/worker/worker_channel_spec.rb +201 -0
  76. data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +2 -3
  77. data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
  78. data/spec/jwt/access_token_spec.rb +27 -0
  79. metadata +84 -42
  80. data/lib/twilio-ruby/rest/api/v2010/account/sms.rb +0 -134
  81. data/lib/twilio-ruby/rest/api/v2010/account/sms/short_code.rb +0 -408
  82. data/spec/integration/api/v2010/account/sms/sms_message_spec.rb +0 -275
  83. data/spec/integration/api/v2010/account/sms_spec.rb +0 -10
@@ -0,0 +1,411 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Sync < Version
11
+ class ServiceContext < InstanceContext
12
+ class SyncMapContext < InstanceContext
13
+ class SyncMapItemList < ListResource
14
+ ##
15
+ # Initialize the SyncMapItemList
16
+ # @param [Version] version Version that contains the resource
17
+ # @param [String] service_sid The service_sid
18
+ # @param [String] map_sid The map_sid
19
+ # @return [SyncMapItemList] SyncMapItemList
20
+ def initialize(version, service_sid: nil, map_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {
25
+ service_sid: service_sid,
26
+ map_sid: map_sid
27
+ }
28
+ @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items"
29
+ end
30
+
31
+ ##
32
+ # Retrieve a single page of SyncMapItemInstance records from the API.
33
+ # Request is executed immediately.
34
+ # @param [String] key The key
35
+ # @param [Hash] data The data
36
+ # @return [SyncMapItemInstance] Newly created SyncMapItemInstance
37
+ def create(key: nil, data: nil)
38
+ data = {
39
+ 'Key' => key,
40
+ 'Data' => data,
41
+ }
42
+
43
+ payload = @version.create(
44
+ 'POST',
45
+ @uri,
46
+ data: data
47
+ )
48
+
49
+ return SyncMapItemInstance.new(
50
+ @version,
51
+ payload,
52
+ service_sid: @solution[:service_sid],
53
+ map_sid: @solution[:map_sid],
54
+ )
55
+ end
56
+
57
+ ##
58
+ # Lists SyncMapItemInstance records from the API as a list.
59
+ # Unlike stream(), this operation is eager and will load `limit` records into
60
+ # memory before returning.
61
+ # @param [sync_map_item.QueryResultOrder] order The order
62
+ # @param [String] from The from
63
+ # @param [sync_map_item.QueryFromBoundType] bounds The bounds
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 not set will use
67
+ # the default value of 50 records. If no page_size is defined
68
+ # but a limit is defined, stream() will attempt to read the
69
+ # limit with the most efficient page size, i.e. min(limit, 1000)
70
+ # @return [Array] Array of up to limit results
71
+ def list(order: nil, from: nil, bounds: nil, limit: nil, page_size: nil)
72
+ self.stream(
73
+ order: order,
74
+ from: from,
75
+ bounds: bounds,
76
+ limit: limit,
77
+ page_size: page_size
78
+ ).entries
79
+ end
80
+
81
+ ##
82
+ # Streams SyncMapItemInstance records from the API as an Enumerable.
83
+ # This operation lazily loads records as efficiently as possible until the limit
84
+ # is reached.
85
+ # @param [sync_map_item.QueryResultOrder] order The order
86
+ # @param [String] from The from
87
+ # @param [sync_map_item.QueryFromBoundType] bounds The bounds
88
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
89
+ # guarantees to never return more than limit. Default is no limit
90
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
91
+ # the default value of 50 records. If no page_size is defined
92
+ # but a limit is defined, stream() will attempt to read the
93
+ # limit with the most efficient page size, i.e. min(limit, 1000)
94
+ # @return [Enumerable] Enumerable that will yield up to limit results
95
+ def stream(order: nil, from: nil, bounds: nil, limit: nil, page_size: nil)
96
+ limits = @version.read_limits(limit, page_size)
97
+
98
+ page = self.page(
99
+ order: order,
100
+ from: from,
101
+ bounds: bounds,
102
+ page_size: limits[:page_size],
103
+ )
104
+
105
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
106
+ end
107
+
108
+ ##
109
+ # When passed a block, yields SyncMapItemInstance records from the API.
110
+ # This operation lazily loads records as efficiently as possible until the limit
111
+ # is reached.
112
+ # @param [sync_map_item.QueryResultOrder] order The order
113
+ # @param [String] from The from
114
+ # @param [sync_map_item.QueryFromBoundType] bounds The bounds
115
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
116
+ # guarantees to never return more than limit. Default is no limit
117
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
118
+ # the default value of 50 records. If no page_size is defined
119
+ # but a limit is defined, stream() will attempt to read the
120
+ # limit with the most efficient page size, i.e. min(limit, 1000)
121
+ def each
122
+ limits = @version.read_limits
123
+
124
+ page = self.page(
125
+ page_size: limits[:page_size],
126
+ )
127
+
128
+ @version.stream(page,
129
+ limit: limits[:limit],
130
+ page_limit: limits[:page_limit]).each {|x| yield x}
131
+ end
132
+
133
+ ##
134
+ # Retrieve a single page of SyncMapItemInstance records from the API.
135
+ # Request is executed immediately.
136
+ # @param [sync_map_item.QueryResultOrder] order The order
137
+ # @param [String] from The from
138
+ # @param [sync_map_item.QueryFromBoundType] bounds The bounds
139
+ # @param [String] page_token PageToken provided by the API
140
+ # @param [Integer] page_number Page Number, this value is simply for client state
141
+ # @param [Integer] page_size Number of records to return, defaults to 50
142
+ # @return [Page] Page of SyncMapItemInstance
143
+ def page(order: nil, from: nil, bounds: nil, page_token: nil, page_number: nil, page_size: nil)
144
+ params = {
145
+ 'Order' => order,
146
+ 'From' => from,
147
+ 'Bounds' => bounds,
148
+ 'PageToken' => page_token,
149
+ 'Page' => page_number,
150
+ 'PageSize' => page_size,
151
+ }
152
+ response = @version.page(
153
+ 'GET',
154
+ @uri,
155
+ params
156
+ )
157
+ return SyncMapItemPage.new(@version, response, @solution)
158
+ end
159
+
160
+ ##
161
+ # Provide a user friendly representation
162
+ def to_s
163
+ '#<Twilio.Preview.Sync.SyncMapItemList>'
164
+ end
165
+ end
166
+
167
+ class SyncMapItemPage < Page
168
+ ##
169
+ # Initialize the SyncMapItemPage
170
+ # @param [Version] version Version that contains the resource
171
+ # @param [Response] response Response from the API
172
+ # @param [Hash] solution Path solution for the resource
173
+ # @param [String] service_sid The service_sid
174
+ # @param [String] map_sid The map_sid
175
+ # @return [SyncMapItemPage] SyncMapItemPage
176
+ def initialize(version, response, solution)
177
+ super(version, response)
178
+
179
+ # Path Solution
180
+ @solution = solution
181
+ end
182
+
183
+ ##
184
+ # Build an instance of SyncMapItemInstance
185
+ # @param [Hash] payload Payload response from the API
186
+ # @return [SyncMapItemInstance] SyncMapItemInstance
187
+ def get_instance(payload)
188
+ return SyncMapItemInstance.new(
189
+ @version,
190
+ payload,
191
+ service_sid: @solution[:service_sid],
192
+ map_sid: @solution[:map_sid],
193
+ )
194
+ end
195
+
196
+ ##
197
+ # Provide a user friendly representation
198
+ def to_s
199
+ '<Twilio.Preview.Sync.SyncMapItemPage>'
200
+ end
201
+ end
202
+
203
+ class SyncMapItemContext < InstanceContext
204
+ ##
205
+ # Initialize the SyncMapItemContext
206
+ # @param [Version] version Version that contains the resource
207
+ # @param [String] service_sid The service_sid
208
+ # @param [String] map_sid The map_sid
209
+ # @param [String] key The key
210
+ # @return [SyncMapItemContext] SyncMapItemContext
211
+ def initialize(version, service_sid, map_sid, key)
212
+ super(version)
213
+
214
+ # Path Solution
215
+ @solution = {
216
+ service_sid: service_sid,
217
+ map_sid: map_sid,
218
+ key: key,
219
+ }
220
+ @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items/#{@solution[:key]}"
221
+ end
222
+
223
+ ##
224
+ # Fetch a SyncMapItemInstance
225
+ # @return [SyncMapItemInstance] Fetched SyncMapItemInstance
226
+ def fetch
227
+ params = {}
228
+
229
+ payload = @version.fetch(
230
+ 'GET',
231
+ @uri,
232
+ params,
233
+ )
234
+
235
+ return SyncMapItemInstance.new(
236
+ @version,
237
+ payload,
238
+ service_sid: @solution[:service_sid],
239
+ map_sid: @solution[:map_sid],
240
+ key: @solution[:key],
241
+ )
242
+ end
243
+
244
+ ##
245
+ # Deletes the SyncMapItemInstance
246
+ # @return [Boolean] true if delete succeeds, true otherwise
247
+ def delete
248
+ return @version.delete('delete', @uri)
249
+ end
250
+
251
+ ##
252
+ # Update the SyncMapItemInstance
253
+ # @param [Hash] data The data
254
+ # @return [SyncMapItemInstance] Updated SyncMapItemInstance
255
+ def update(data: nil)
256
+ data = {
257
+ 'Data' => data,
258
+ }
259
+
260
+ payload = @version.update(
261
+ 'POST',
262
+ @uri,
263
+ data: data,
264
+ )
265
+
266
+ return SyncMapItemInstance.new(
267
+ @version,
268
+ payload,
269
+ service_sid: @solution[:service_sid],
270
+ map_sid: @solution[:map_sid],
271
+ key: @solution[:key],
272
+ )
273
+ end
274
+
275
+ ##
276
+ # Provide a user friendly representation
277
+ def to_s
278
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
279
+ "#<Twilio.Preview.Sync.SyncMapItemContext #{context}>"
280
+ end
281
+ end
282
+
283
+ class SyncMapItemInstance < InstanceResource
284
+ ##
285
+ # Initialize the SyncMapItemInstance
286
+ # @param [Version] version Version that contains the resource
287
+ # @param [Hash] payload payload that contains response from Twilio
288
+ # @param [String] service_sid The service_sid
289
+ # @param [String] map_sid The map_sid
290
+ # @param [String] key The key
291
+ # @return [SyncMapItemInstance] SyncMapItemInstance
292
+ def initialize(version, payload, service_sid: nil, map_sid: nil, key: nil)
293
+ super(version)
294
+
295
+ # Marshaled Properties
296
+ @properties = {
297
+ 'key' => payload['key'],
298
+ 'account_sid' => payload['account_sid'],
299
+ 'service_sid' => payload['service_sid'],
300
+ 'map_sid' => payload['map_sid'],
301
+ 'url' => payload['url'],
302
+ 'revision' => payload['revision'],
303
+ 'data' => payload['data'],
304
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
305
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
306
+ 'created_by' => payload['created_by'],
307
+ }
308
+
309
+ # Context
310
+ @instance_context = nil
311
+ @params = {
312
+ 'service_sid' => service_sid,
313
+ 'map_sid' => map_sid,
314
+ 'key' => key || @properties['key'],
315
+ }
316
+ end
317
+
318
+ ##
319
+ # Generate an instance context for the instance, the context is capable of
320
+ # performing various actions. All instance actions are proxied to the context
321
+ # @param [Version] version Version that contains the resource
322
+ # @return [SyncMapItemContext] SyncMapItemContext for this SyncMapItemInstance
323
+ def context
324
+ unless @instance_context
325
+ @instance_context = SyncMapItemContext.new(
326
+ @version,
327
+ @params['service_sid'],
328
+ @params['map_sid'],
329
+ @params['key'],
330
+ )
331
+ end
332
+ @instance_context
333
+ end
334
+
335
+ def key
336
+ @properties['key']
337
+ end
338
+
339
+ def account_sid
340
+ @properties['account_sid']
341
+ end
342
+
343
+ def service_sid
344
+ @properties['service_sid']
345
+ end
346
+
347
+ def map_sid
348
+ @properties['map_sid']
349
+ end
350
+
351
+ def url
352
+ @properties['url']
353
+ end
354
+
355
+ def revision
356
+ @properties['revision']
357
+ end
358
+
359
+ def data
360
+ @properties['data']
361
+ end
362
+
363
+ def date_created
364
+ @properties['date_created']
365
+ end
366
+
367
+ def date_updated
368
+ @properties['date_updated']
369
+ end
370
+
371
+ def created_by
372
+ @properties['created_by']
373
+ end
374
+
375
+ ##
376
+ # Fetch a SyncMapItemInstance
377
+ # @return [SyncMapItemInstance] Fetched SyncMapItemInstance
378
+ def fetch
379
+ context.fetch
380
+ end
381
+
382
+ ##
383
+ # Deletes the SyncMapItemInstance
384
+ # @return [Boolean] true if delete succeeds, true otherwise
385
+ def delete
386
+ context.delete
387
+ end
388
+
389
+ ##
390
+ # Update the SyncMapItemInstance
391
+ # @param [Hash] data The data
392
+ # @return [SyncMapItemInstance] Updated SyncMapItemInstance
393
+ def update(data: nil)
394
+ context.update(
395
+ data: data,
396
+ )
397
+ end
398
+
399
+ ##
400
+ # Provide a user friendly representation
401
+ def to_s
402
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
403
+ "<Twilio.Preview.Sync.SyncMapItemInstance #{values}>"
404
+ end
405
+ end
406
+ end
407
+ end
408
+ end
409
+ end
410
+ end
411
+ end
@@ -245,17 +245,19 @@ module Twilio
245
245
  # @param [String] callback_method The callback_method
246
246
  # @param [String] callback_url The callback_url
247
247
  # @param [String] friendly_name The friendly_name
248
+ # @param [String] rate_plan The rate_plan
248
249
  # @param [String] sim_identifier The sim_identifier
249
250
  # @param [String] status The status
250
251
  # @param [String] commands_callback_method The commands_callback_method
251
252
  # @param [String] commands_callback_url The commands_callback_url
252
253
  # @return [DeviceInstance] Updated DeviceInstance
253
- def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
254
+ def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
254
255
  data = {
255
256
  'Alias' => alias_,
256
257
  'CallbackMethod' => callback_method,
257
258
  'CallbackUrl' => callback_url,
258
259
  'FriendlyName' => friendly_name,
260
+ 'RatePlan' => rate_plan,
259
261
  'SimIdentifier' => sim_identifier,
260
262
  'Status' => status,
261
263
  'CommandsCallbackMethod' => commands_callback_method,
@@ -407,17 +409,19 @@ module Twilio
407
409
  # @param [String] callback_method The callback_method
408
410
  # @param [String] callback_url The callback_url
409
411
  # @param [String] friendly_name The friendly_name
412
+ # @param [String] rate_plan The rate_plan
410
413
  # @param [String] sim_identifier The sim_identifier
411
414
  # @param [String] status The status
412
415
  # @param [String] commands_callback_method The commands_callback_method
413
416
  # @param [String] commands_callback_url The commands_callback_url
414
417
  # @return [DeviceInstance] Updated DeviceInstance
415
- def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
418
+ def update(alias_: nil, callback_method: nil, callback_url: nil, friendly_name: nil, rate_plan: nil, sim_identifier: nil, status: nil, commands_callback_method: nil, commands_callback_url: nil)
416
419
  context.update(
417
420
  alias_: alias_,
418
421
  callback_method: callback_method,
419
422
  callback_url: callback_url,
420
423
  friendly_name: friendly_name,
424
+ rate_plan: rate_plan,
421
425
  sim_identifier: sim_identifier,
422
426
  status: status,
423
427
  commands_callback_method: commands_callback_method,