twilio-ruby 5.1.1 → 5.1.2
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/CHANGES.md +17 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +8 -2
- data/lib/twilio-ruby/rest/chat/v2/service.rb +13 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +14 -0
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +13 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +14 -0
- data/lib/twilio-ruby/rest/preview.rb +16 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +2 -13
- data/lib/twilio-ruby/rest/preview/deployed_devices.rb +42 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb +531 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb +428 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/deployment.rb +412 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb +465 -0
- data/lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb +425 -0
- data/lib/twilio-ruby/rest/sync/v1/service.rb +7 -0
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/chat/v2/service/channel/message_spec.rb +68 -0
- data/spec/integration/chat/v2/service_spec.rb +20 -4
- data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +68 -0
- data/spec/integration/ip_messaging/v2/service_spec.rb +20 -4
- data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +1 -3
- data/spec/integration/preview/deployed_devices/fleet/certificate_spec.rb +238 -0
- data/spec/integration/preview/deployed_devices/fleet/deployment_spec.rb +231 -0
- data/spec/integration/preview/deployed_devices/fleet/device_spec.rb +247 -0
- data/spec/integration/preview/deployed_devices/fleet/key_spec.rb +235 -0
- data/spec/integration/preview/deployed_devices/fleet_spec.rb +244 -0
- data/spec/integration/sync/v1/service_spec.rb +4 -0
- metadata +19 -3
@@ -0,0 +1,425 @@
|
|
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 DeployedDevices < Version
|
11
|
+
class FleetContext < InstanceContext
|
12
|
+
##
|
13
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
14
|
+
class KeyList < ListResource
|
15
|
+
##
|
16
|
+
# Initialize the KeyList
|
17
|
+
# @param [Version] version Version that contains the resource
|
18
|
+
# @param [String] fleet_sid Specifies the unique string identifier of the Fleet
|
19
|
+
# that the given Key credential belongs to.
|
20
|
+
# @return [KeyList] KeyList
|
21
|
+
def initialize(version, fleet_sid: nil)
|
22
|
+
super(version)
|
23
|
+
|
24
|
+
# Path Solution
|
25
|
+
@solution = {
|
26
|
+
fleet_sid: fleet_sid
|
27
|
+
}
|
28
|
+
@uri = "/Fleets/#{@solution[:fleet_sid]}/Keys"
|
29
|
+
end
|
30
|
+
|
31
|
+
##
|
32
|
+
# Retrieve a single page of KeyInstance records from the API.
|
33
|
+
# Request is executed immediately.
|
34
|
+
# @param [String] friendly_name Provides a human readable descriptive text for
|
35
|
+
# this Key credential, up to 256 characters long.
|
36
|
+
# @param [String] device_sid Provides the unique string identifier of an existing
|
37
|
+
# Device to become authenticated with this Key credential.
|
38
|
+
# @return [KeyInstance] Newly created KeyInstance
|
39
|
+
def create(friendly_name: :unset, device_sid: :unset)
|
40
|
+
data = Twilio::Values.of({
|
41
|
+
'FriendlyName' => friendly_name,
|
42
|
+
'DeviceSid' => device_sid,
|
43
|
+
})
|
44
|
+
|
45
|
+
payload = @version.create(
|
46
|
+
'POST',
|
47
|
+
@uri,
|
48
|
+
data: data
|
49
|
+
)
|
50
|
+
|
51
|
+
KeyInstance.new(
|
52
|
+
@version,
|
53
|
+
payload,
|
54
|
+
fleet_sid: @solution[:fleet_sid],
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# Lists KeyInstance records from the API as a list.
|
60
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
61
|
+
# memory before returning.
|
62
|
+
# @param [String] device_sid Filters the resulting list of Keys by a unique string
|
63
|
+
# identifier of an authenticated Device.
|
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 [Array] Array of up to limit results
|
71
|
+
def list(device_sid: :unset, limit: nil, page_size: nil)
|
72
|
+
self.stream(
|
73
|
+
device_sid: device_sid,
|
74
|
+
limit: limit,
|
75
|
+
page_size: page_size
|
76
|
+
).entries
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Streams KeyInstance records from the API as an Enumerable.
|
81
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
82
|
+
# is reached.
|
83
|
+
# @param [String] device_sid Filters the resulting list of Keys by a unique string
|
84
|
+
# identifier of an authenticated Device.
|
85
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
86
|
+
# guarantees to never return more than limit. Default is no limit.
|
87
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
88
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
89
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
90
|
+
# efficient page size, i.e. min(limit, 1000)
|
91
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
92
|
+
def stream(device_sid: :unset, limit: nil, page_size: nil)
|
93
|
+
limits = @version.read_limits(limit, page_size)
|
94
|
+
|
95
|
+
page = self.page(
|
96
|
+
device_sid: device_sid,
|
97
|
+
page_size: limits[:page_size],
|
98
|
+
)
|
99
|
+
|
100
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# When passed a block, yields KeyInstance records from the API.
|
105
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
106
|
+
# is reached.
|
107
|
+
def each
|
108
|
+
limits = @version.read_limits
|
109
|
+
|
110
|
+
page = self.page(
|
111
|
+
page_size: limits[:page_size],
|
112
|
+
)
|
113
|
+
|
114
|
+
@version.stream(page,
|
115
|
+
limit: limits[:limit],
|
116
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# Retrieve a single page of KeyInstance records from the API.
|
121
|
+
# Request is executed immediately.
|
122
|
+
# @param [String] device_sid Filters the resulting list of Keys by a unique string
|
123
|
+
# identifier of an authenticated Device.
|
124
|
+
# @param [String] page_token PageToken provided by the API
|
125
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
126
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
127
|
+
# @return [Page] Page of KeyInstance
|
128
|
+
def page(device_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
129
|
+
params = Twilio::Values.of({
|
130
|
+
'DeviceSid' => device_sid,
|
131
|
+
'PageToken' => page_token,
|
132
|
+
'Page' => page_number,
|
133
|
+
'PageSize' => page_size,
|
134
|
+
})
|
135
|
+
response = @version.page(
|
136
|
+
'GET',
|
137
|
+
@uri,
|
138
|
+
params
|
139
|
+
)
|
140
|
+
KeyPage.new(@version, response, @solution)
|
141
|
+
end
|
142
|
+
|
143
|
+
##
|
144
|
+
# Retrieve a single page of KeyInstance records from the API.
|
145
|
+
# Request is executed immediately.
|
146
|
+
# @param [String] target_url API-generated URL for the requested results page
|
147
|
+
# @return [Page] Page of KeyInstance
|
148
|
+
def get_page(target_url)
|
149
|
+
response = @version.domain.request(
|
150
|
+
'GET',
|
151
|
+
target_url
|
152
|
+
)
|
153
|
+
KeyPage.new(@version, response, @solution)
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# Provide a user friendly representation
|
158
|
+
def to_s
|
159
|
+
'#<Twilio.Preview.DeployedDevices.KeyList>'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
##
|
164
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
165
|
+
class KeyPage < Page
|
166
|
+
##
|
167
|
+
# Initialize the KeyPage
|
168
|
+
# @param [Version] version Version that contains the resource
|
169
|
+
# @param [Response] response Response from the API
|
170
|
+
# @param [Hash] solution Path solution for the resource
|
171
|
+
# @return [KeyPage] KeyPage
|
172
|
+
def initialize(version, response, solution)
|
173
|
+
super(version, response)
|
174
|
+
|
175
|
+
# Path Solution
|
176
|
+
@solution = solution
|
177
|
+
end
|
178
|
+
|
179
|
+
##
|
180
|
+
# Build an instance of KeyInstance
|
181
|
+
# @param [Hash] payload Payload response from the API
|
182
|
+
# @return [KeyInstance] KeyInstance
|
183
|
+
def get_instance(payload)
|
184
|
+
KeyInstance.new(
|
185
|
+
@version,
|
186
|
+
payload,
|
187
|
+
fleet_sid: @solution[:fleet_sid],
|
188
|
+
)
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# Provide a user friendly representation
|
193
|
+
def to_s
|
194
|
+
'<Twilio.Preview.DeployedDevices.KeyPage>'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
##
|
199
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
200
|
+
class KeyContext < InstanceContext
|
201
|
+
##
|
202
|
+
# Initialize the KeyContext
|
203
|
+
# @param [Version] version Version that contains the resource
|
204
|
+
# @param [String] fleet_sid The fleet_sid
|
205
|
+
# @param [String] sid Provides a 34 character string that uniquely identifies the
|
206
|
+
# requested Key credential resource.
|
207
|
+
# @return [KeyContext] KeyContext
|
208
|
+
def initialize(version, fleet_sid, sid)
|
209
|
+
super(version)
|
210
|
+
|
211
|
+
# Path Solution
|
212
|
+
@solution = {
|
213
|
+
fleet_sid: fleet_sid,
|
214
|
+
sid: sid,
|
215
|
+
}
|
216
|
+
@uri = "/Fleets/#{@solution[:fleet_sid]}/Keys/#{@solution[:sid]}"
|
217
|
+
end
|
218
|
+
|
219
|
+
##
|
220
|
+
# Fetch a KeyInstance
|
221
|
+
# @return [KeyInstance] Fetched KeyInstance
|
222
|
+
def fetch
|
223
|
+
params = Twilio::Values.of({})
|
224
|
+
|
225
|
+
payload = @version.fetch(
|
226
|
+
'GET',
|
227
|
+
@uri,
|
228
|
+
params,
|
229
|
+
)
|
230
|
+
|
231
|
+
KeyInstance.new(
|
232
|
+
@version,
|
233
|
+
payload,
|
234
|
+
fleet_sid: @solution[:fleet_sid],
|
235
|
+
sid: @solution[:sid],
|
236
|
+
)
|
237
|
+
end
|
238
|
+
|
239
|
+
##
|
240
|
+
# Deletes the KeyInstance
|
241
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
242
|
+
def delete
|
243
|
+
@version.delete('delete', @uri)
|
244
|
+
end
|
245
|
+
|
246
|
+
##
|
247
|
+
# Update the KeyInstance
|
248
|
+
# @param [String] friendly_name Provides a human readable descriptive text for
|
249
|
+
# this Key credential, up to 256 characters long.
|
250
|
+
# @param [String] device_sid Provides the unique string identifier of an existing
|
251
|
+
# Device to become authenticated with this Key credential.
|
252
|
+
# @return [KeyInstance] Updated KeyInstance
|
253
|
+
def update(friendly_name: :unset, device_sid: :unset)
|
254
|
+
data = Twilio::Values.of({
|
255
|
+
'FriendlyName' => friendly_name,
|
256
|
+
'DeviceSid' => device_sid,
|
257
|
+
})
|
258
|
+
|
259
|
+
payload = @version.update(
|
260
|
+
'POST',
|
261
|
+
@uri,
|
262
|
+
data: data,
|
263
|
+
)
|
264
|
+
|
265
|
+
KeyInstance.new(
|
266
|
+
@version,
|
267
|
+
payload,
|
268
|
+
fleet_sid: @solution[:fleet_sid],
|
269
|
+
sid: @solution[:sid],
|
270
|
+
)
|
271
|
+
end
|
272
|
+
|
273
|
+
##
|
274
|
+
# Provide a user friendly representation
|
275
|
+
def to_s
|
276
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
277
|
+
"#<Twilio.Preview.DeployedDevices.KeyContext #{context}>"
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
##
|
282
|
+
# PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
|
283
|
+
class KeyInstance < InstanceResource
|
284
|
+
##
|
285
|
+
# Initialize the KeyInstance
|
286
|
+
# @param [Version] version Version that contains the resource
|
287
|
+
# @param [Hash] payload payload that contains response from Twilio
|
288
|
+
# @param [String] fleet_sid Specifies the unique string identifier of the Fleet
|
289
|
+
# that the given Key credential belongs to.
|
290
|
+
# @param [String] sid Provides a 34 character string that uniquely identifies the
|
291
|
+
# requested Key credential resource.
|
292
|
+
# @return [KeyInstance] KeyInstance
|
293
|
+
def initialize(version, payload, fleet_sid: nil, sid: nil)
|
294
|
+
super(version)
|
295
|
+
|
296
|
+
# Marshaled Properties
|
297
|
+
@properties = {
|
298
|
+
'sid' => payload['sid'],
|
299
|
+
'url' => payload['url'],
|
300
|
+
'friendly_name' => payload['friendly_name'],
|
301
|
+
'fleet_sid' => payload['fleet_sid'],
|
302
|
+
'account_sid' => payload['account_sid'],
|
303
|
+
'device_sid' => payload['device_sid'],
|
304
|
+
'secret' => payload['secret'],
|
305
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
306
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
307
|
+
}
|
308
|
+
|
309
|
+
# Context
|
310
|
+
@instance_context = nil
|
311
|
+
@params = {
|
312
|
+
'fleet_sid' => fleet_sid,
|
313
|
+
'sid' => sid || @properties['sid'],
|
314
|
+
}
|
315
|
+
end
|
316
|
+
|
317
|
+
##
|
318
|
+
# Generate an instance context for the instance, the context is capable of
|
319
|
+
# performing various actions. All instance actions are proxied to the context
|
320
|
+
# @return [KeyContext] KeyContext for this KeyInstance
|
321
|
+
def context
|
322
|
+
unless @instance_context
|
323
|
+
@instance_context = KeyContext.new(
|
324
|
+
@version,
|
325
|
+
@params['fleet_sid'],
|
326
|
+
@params['sid'],
|
327
|
+
)
|
328
|
+
end
|
329
|
+
@instance_context
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# @return [String] A string that uniquely identifies this Key.
|
334
|
+
def sid
|
335
|
+
@properties['sid']
|
336
|
+
end
|
337
|
+
|
338
|
+
##
|
339
|
+
# @return [String] URL of this Key.
|
340
|
+
def url
|
341
|
+
@properties['url']
|
342
|
+
end
|
343
|
+
|
344
|
+
##
|
345
|
+
# @return [String] A human readable description for this Key.
|
346
|
+
def friendly_name
|
347
|
+
@properties['friendly_name']
|
348
|
+
end
|
349
|
+
|
350
|
+
##
|
351
|
+
# @return [String] The unique identifier of the Fleet.
|
352
|
+
def fleet_sid
|
353
|
+
@properties['fleet_sid']
|
354
|
+
end
|
355
|
+
|
356
|
+
##
|
357
|
+
# @return [String] The unique SID that identifies this Account.
|
358
|
+
def account_sid
|
359
|
+
@properties['account_sid']
|
360
|
+
end
|
361
|
+
|
362
|
+
##
|
363
|
+
# @return [String] The unique identifier of a mapped Device.
|
364
|
+
def device_sid
|
365
|
+
@properties['device_sid']
|
366
|
+
end
|
367
|
+
|
368
|
+
##
|
369
|
+
# @return [String] The key secret.
|
370
|
+
def secret
|
371
|
+
@properties['secret']
|
372
|
+
end
|
373
|
+
|
374
|
+
##
|
375
|
+
# @return [Time] The date this Key credential was created.
|
376
|
+
def date_created
|
377
|
+
@properties['date_created']
|
378
|
+
end
|
379
|
+
|
380
|
+
##
|
381
|
+
# @return [Time] The date this Key credential was updated.
|
382
|
+
def date_updated
|
383
|
+
@properties['date_updated']
|
384
|
+
end
|
385
|
+
|
386
|
+
##
|
387
|
+
# Fetch a KeyInstance
|
388
|
+
# @return [KeyInstance] Fetched KeyInstance
|
389
|
+
def fetch
|
390
|
+
context.fetch
|
391
|
+
end
|
392
|
+
|
393
|
+
##
|
394
|
+
# Deletes the KeyInstance
|
395
|
+
# @return [Boolean] true if delete succeeds, true otherwise
|
396
|
+
def delete
|
397
|
+
context.delete
|
398
|
+
end
|
399
|
+
|
400
|
+
##
|
401
|
+
# Update the KeyInstance
|
402
|
+
# @param [String] friendly_name Provides a human readable descriptive text for
|
403
|
+
# this Key credential, up to 256 characters long.
|
404
|
+
# @param [String] device_sid Provides the unique string identifier of an existing
|
405
|
+
# Device to become authenticated with this Key credential.
|
406
|
+
# @return [KeyInstance] Updated KeyInstance
|
407
|
+
def update(friendly_name: :unset, device_sid: :unset)
|
408
|
+
context.update(
|
409
|
+
friendly_name: friendly_name,
|
410
|
+
device_sid: device_sid,
|
411
|
+
)
|
412
|
+
end
|
413
|
+
|
414
|
+
##
|
415
|
+
# Provide a user friendly representation
|
416
|
+
def to_s
|
417
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
418
|
+
"<Twilio.Preview.DeployedDevices.KeyInstance #{values}>"
|
419
|
+
end
|
420
|
+
end
|
421
|
+
end
|
422
|
+
end
|
423
|
+
end
|
424
|
+
end
|
425
|
+
end
|
@@ -356,6 +356,7 @@ module Twilio
|
|
356
356
|
# Marshaled Properties
|
357
357
|
@properties = {
|
358
358
|
'sid' => payload['sid'],
|
359
|
+
'unique_name' => payload['unique_name'],
|
359
360
|
'account_sid' => payload['account_sid'],
|
360
361
|
'friendly_name' => payload['friendly_name'],
|
361
362
|
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
@@ -394,6 +395,12 @@ module Twilio
|
|
394
395
|
@properties['sid']
|
395
396
|
end
|
396
397
|
|
398
|
+
##
|
399
|
+
# @return [String] The unique_name
|
400
|
+
def unique_name
|
401
|
+
@properties['unique_name']
|
402
|
+
end
|
403
|
+
|
397
404
|
##
|
398
405
|
# @return [String] The account_sid
|
399
406
|
def account_sid
|
data/lib/twilio-ruby/version.rb
CHANGED