twilio-ruby 7.3.2 → 7.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,463 +0,0 @@
1
- ##
2
- # This code was generated by
3
- # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
- # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
- # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
- #
7
- # Twilio - Preview
8
- # This is the public Twilio REST API.
9
- #
10
- # NOTE: This class is auto generated by OpenAPI Generator.
11
- # https://openapi-generator.tech
12
- # Do not edit the class manually.
13
- #
14
-
15
-
16
- module Twilio
17
- module REST
18
- class Preview < PreviewBase
19
- class DeployedDevices < Version
20
- class FleetContext < InstanceContext
21
-
22
- class DeviceList < ListResource
23
-
24
- ##
25
- # Initialize the DeviceList
26
- # @param [Version] version Version that contains the resource
27
- # @return [DeviceList] DeviceList
28
- def initialize(version, fleet_sid: nil)
29
- super(version)
30
- # Path Solution
31
- @solution = { fleet_sid: fleet_sid }
32
- @uri = "/Fleets/#{@solution[:fleet_sid]}/Devices"
33
-
34
- end
35
- ##
36
- # Create the DeviceInstance
37
- # @param [String] unique_name Provides a unique and addressable name to be assigned to this Device, to be used in addition to SID, up to 128 characters long.
38
- # @param [String] friendly_name Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long.
39
- # @param [String] identity Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long.
40
- # @param [String] deployment_sid Specifies the unique string identifier of the Deployment group that this Device is going to be associated with.
41
- # @param [Boolean] enabled
42
- # @return [DeviceInstance] Created DeviceInstance
43
- def create(
44
- unique_name: :unset,
45
- friendly_name: :unset,
46
- identity: :unset,
47
- deployment_sid: :unset,
48
- enabled: :unset
49
- )
50
-
51
- data = Twilio::Values.of({
52
- 'UniqueName' => unique_name,
53
- 'FriendlyName' => friendly_name,
54
- 'Identity' => identity,
55
- 'DeploymentSid' => deployment_sid,
56
- 'Enabled' => enabled,
57
- })
58
-
59
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
60
-
61
- payload = @version.create('POST', @uri, data: data, headers: headers)
62
- DeviceInstance.new(
63
- @version,
64
- payload,
65
- fleet_sid: @solution[:fleet_sid],
66
- )
67
- end
68
-
69
-
70
- ##
71
- # Lists DeviceInstance records from the API as a list.
72
- # Unlike stream(), this operation is eager and will load `limit` records into
73
- # memory before returning.
74
- # @param [String] deployment_sid Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with.
75
- # @param [Integer] limit Upper limit for the number of records to return. stream()
76
- # guarantees to never return more than limit. Default is no limit
77
- # @param [Integer] page_size Number of records to fetch per request, when
78
- # not set will use the default value of 50 records. If no page_size is defined
79
- # but a limit is defined, stream() will attempt to read the limit with the most
80
- # efficient page size, i.e. min(limit, 1000)
81
- # @return [Array] Array of up to limit results
82
- def list(deployment_sid: :unset, limit: nil, page_size: nil)
83
- self.stream(
84
- deployment_sid: deployment_sid,
85
- limit: limit,
86
- page_size: page_size
87
- ).entries
88
- end
89
-
90
- ##
91
- # Streams Instance records from the API as an Enumerable.
92
- # This operation lazily loads records as efficiently as possible until the limit
93
- # is reached.
94
- # @param [String] deployment_sid Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with.
95
- # @param [Integer] limit Upper limit for the number of records to return. stream()
96
- # guarantees to never return more than limit. Default is no limit
97
- # @param [Integer] page_size Number of records to fetch per request, when
98
- # not set will use the default value of 50 records. If no page_size is defined
99
- # but a limit is defined, stream() will attempt to read the limit with the most
100
- # efficient page size, i.e. min(limit, 1000)
101
- # @return [Enumerable] Enumerable that will yield up to limit results
102
- def stream(deployment_sid: :unset, limit: nil, page_size: nil)
103
- limits = @version.read_limits(limit, page_size)
104
-
105
- page = self.page(
106
- deployment_sid: deployment_sid,
107
- page_size: limits[:page_size], )
108
-
109
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
110
- end
111
-
112
- ##
113
- # When passed a block, yields DeviceInstance records from the API.
114
- # This operation lazily loads records as efficiently as possible until the limit
115
- # is reached.
116
- def each
117
- limits = @version.read_limits
118
-
119
- page = self.page(page_size: limits[:page_size], )
120
-
121
- @version.stream(page,
122
- limit: limits[:limit],
123
- page_limit: limits[:page_limit]).each {|x| yield x}
124
- end
125
-
126
- ##
127
- # Retrieve a single page of DeviceInstance records from the API.
128
- # Request is executed immediately.
129
- # @param [String] deployment_sid Filters the resulting list of Devices by a unique string identifier of the Deployment they are associated with.
130
- # @param [String] page_token PageToken provided by the API
131
- # @param [Integer] page_number Page Number, this value is simply for client state
132
- # @param [Integer] page_size Number of records to return, defaults to 50
133
- # @return [Page] Page of DeviceInstance
134
- def page(deployment_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
135
- params = Twilio::Values.of({
136
- 'DeploymentSid' => deployment_sid,
137
- 'PageToken' => page_token,
138
- 'Page' => page_number,
139
- 'PageSize' => page_size,
140
- })
141
-
142
- response = @version.page('GET', @uri, params: params)
143
-
144
- DevicePage.new(@version, response, @solution)
145
- end
146
-
147
- ##
148
- # Retrieve a single page of DeviceInstance records from the API.
149
- # Request is executed immediately.
150
- # @param [String] target_url API-generated URL for the requested results page
151
- # @return [Page] Page of DeviceInstance
152
- def get_page(target_url)
153
- response = @version.domain.request(
154
- 'GET',
155
- target_url
156
- )
157
- DevicePage.new(@version, response, @solution)
158
- end
159
-
160
-
161
-
162
- # Provide a user friendly representation
163
- def to_s
164
- '#<Twilio.Preview.DeployedDevices.DeviceList>'
165
- end
166
- end
167
-
168
-
169
- class DeviceContext < InstanceContext
170
- ##
171
- # Initialize the DeviceContext
172
- # @param [Version] version Version that contains the resource
173
- # @param [String] fleet_sid
174
- # @param [String] sid Provides a 34 character string that uniquely identifies the requested Device resource.
175
- # @return [DeviceContext] DeviceContext
176
- def initialize(version, fleet_sid, sid)
177
- super(version)
178
-
179
- # Path Solution
180
- @solution = { fleet_sid: fleet_sid, sid: sid, }
181
- @uri = "/Fleets/#{@solution[:fleet_sid]}/Devices/#{@solution[:sid]}"
182
-
183
-
184
- end
185
- ##
186
- # Delete the DeviceInstance
187
- # @return [Boolean] True if delete succeeds, false otherwise
188
- def delete
189
-
190
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
191
-
192
- @version.delete('DELETE', @uri, headers: headers)
193
- end
194
-
195
- ##
196
- # Fetch the DeviceInstance
197
- # @return [DeviceInstance] Fetched DeviceInstance
198
- def fetch
199
-
200
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
201
-
202
- payload = @version.fetch('GET', @uri, headers: headers)
203
- DeviceInstance.new(
204
- @version,
205
- payload,
206
- fleet_sid: @solution[:fleet_sid],
207
- sid: @solution[:sid],
208
- )
209
- end
210
-
211
- ##
212
- # Update the DeviceInstance
213
- # @param [String] friendly_name Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long.
214
- # @param [String] identity Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long.
215
- # @param [String] deployment_sid Specifies the unique string identifier of the Deployment group that this Device is going to be associated with.
216
- # @param [Boolean] enabled
217
- # @return [DeviceInstance] Updated DeviceInstance
218
- def update(
219
- friendly_name: :unset,
220
- identity: :unset,
221
- deployment_sid: :unset,
222
- enabled: :unset
223
- )
224
-
225
- data = Twilio::Values.of({
226
- 'FriendlyName' => friendly_name,
227
- 'Identity' => identity,
228
- 'DeploymentSid' => deployment_sid,
229
- 'Enabled' => enabled,
230
- })
231
-
232
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
233
-
234
- payload = @version.update('POST', @uri, data: data, headers: headers)
235
- DeviceInstance.new(
236
- @version,
237
- payload,
238
- fleet_sid: @solution[:fleet_sid],
239
- sid: @solution[:sid],
240
- )
241
- end
242
-
243
-
244
- ##
245
- # Provide a user friendly representation
246
- def to_s
247
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
248
- "#<Twilio.Preview.DeployedDevices.DeviceContext #{context}>"
249
- end
250
-
251
- ##
252
- # Provide a detailed, user friendly representation
253
- def inspect
254
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
255
- "#<Twilio.Preview.DeployedDevices.DeviceContext #{context}>"
256
- end
257
- end
258
-
259
- class DevicePage < Page
260
- ##
261
- # Initialize the DevicePage
262
- # @param [Version] version Version that contains the resource
263
- # @param [Response] response Response from the API
264
- # @param [Hash] solution Path solution for the resource
265
- # @return [DevicePage] DevicePage
266
- def initialize(version, response, solution)
267
- super(version, response)
268
-
269
- # Path Solution
270
- @solution = solution
271
- end
272
-
273
- ##
274
- # Build an instance of DeviceInstance
275
- # @param [Hash] payload Payload response from the API
276
- # @return [DeviceInstance] DeviceInstance
277
- def get_instance(payload)
278
- DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid])
279
- end
280
-
281
- ##
282
- # Provide a user friendly representation
283
- def to_s
284
- '<Twilio.Preview.DeployedDevices.DevicePage>'
285
- end
286
- end
287
- class DeviceInstance < InstanceResource
288
- ##
289
- # Initialize the DeviceInstance
290
- # @param [Version] version Version that contains the resource
291
- # @param [Hash] payload payload that contains response from Twilio
292
- # @param [String] account_sid The SID of the
293
- # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Device
294
- # resource.
295
- # @param [String] sid The SID of the Call resource to fetch.
296
- # @return [DeviceInstance] DeviceInstance
297
- def initialize(version, payload , fleet_sid: nil, sid: nil)
298
- super(version)
299
-
300
- # Marshaled Properties
301
- @properties = {
302
- 'sid' => payload['sid'],
303
- 'url' => payload['url'],
304
- 'unique_name' => payload['unique_name'],
305
- 'friendly_name' => payload['friendly_name'],
306
- 'fleet_sid' => payload['fleet_sid'],
307
- 'enabled' => payload['enabled'],
308
- 'account_sid' => payload['account_sid'],
309
- 'identity' => payload['identity'],
310
- 'deployment_sid' => payload['deployment_sid'],
311
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
312
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
313
- 'date_authenticated' => Twilio.deserialize_iso8601_datetime(payload['date_authenticated']),
314
- }
315
-
316
- # Context
317
- @instance_context = nil
318
- @params = { 'fleet_sid' => fleet_sid || @properties['fleet_sid'] ,'sid' => sid || @properties['sid'] , }
319
- end
320
-
321
- ##
322
- # Generate an instance context for the instance, the context is capable of
323
- # performing various actions. All instance actions are proxied to the context
324
- # @return [DeviceContext] CallContext for this CallInstance
325
- def context
326
- unless @instance_context
327
- @instance_context = DeviceContext.new(@version , @params['fleet_sid'], @params['sid'])
328
- end
329
- @instance_context
330
- end
331
-
332
- ##
333
- # @return [String] Contains a 34 character string that uniquely identifies this Device resource.
334
- def sid
335
- @properties['sid']
336
- end
337
-
338
- ##
339
- # @return [String] Contains an absolute URL for this Device resource.
340
- def url
341
- @properties['url']
342
- end
343
-
344
- ##
345
- # @return [String] Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long.
346
- def unique_name
347
- @properties['unique_name']
348
- end
349
-
350
- ##
351
- # @return [String] Contains a human readable descriptive text for this Device, up to 256 characters long
352
- def friendly_name
353
- @properties['friendly_name']
354
- end
355
-
356
- ##
357
- # @return [String] Specifies the unique string identifier of the Fleet that the given Device belongs to.
358
- def fleet_sid
359
- @properties['fleet_sid']
360
- end
361
-
362
- ##
363
- # @return [Boolean] Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false.
364
- def enabled
365
- @properties['enabled']
366
- end
367
-
368
- ##
369
- # @return [String] Specifies the unique string identifier of the Account responsible for this Device.
370
- def account_sid
371
- @properties['account_sid']
372
- end
373
-
374
- ##
375
- # @return [String] Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long.
376
- def identity
377
- @properties['identity']
378
- end
379
-
380
- ##
381
- # @return [String] Specifies the unique string identifier of the Deployment group that this Device is associated with.
382
- def deployment_sid
383
- @properties['deployment_sid']
384
- end
385
-
386
- ##
387
- # @return [Time] Specifies the date this Device was created, given in UTC ISO 8601 format.
388
- def date_created
389
- @properties['date_created']
390
- end
391
-
392
- ##
393
- # @return [Time] Specifies the date this Device was last updated, given in UTC ISO 8601 format.
394
- def date_updated
395
- @properties['date_updated']
396
- end
397
-
398
- ##
399
- # @return [Time] Specifies the date this Device was last authenticated, given in UTC ISO 8601 format.
400
- def date_authenticated
401
- @properties['date_authenticated']
402
- end
403
-
404
- ##
405
- # Delete the DeviceInstance
406
- # @return [Boolean] True if delete succeeds, false otherwise
407
- def delete
408
-
409
- context.delete
410
- end
411
-
412
- ##
413
- # Fetch the DeviceInstance
414
- # @return [DeviceInstance] Fetched DeviceInstance
415
- def fetch
416
-
417
- context.fetch
418
- end
419
-
420
- ##
421
- # Update the DeviceInstance
422
- # @param [String] friendly_name Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long.
423
- # @param [String] identity Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long.
424
- # @param [String] deployment_sid Specifies the unique string identifier of the Deployment group that this Device is going to be associated with.
425
- # @param [Boolean] enabled
426
- # @return [DeviceInstance] Updated DeviceInstance
427
- def update(
428
- friendly_name: :unset,
429
- identity: :unset,
430
- deployment_sid: :unset,
431
- enabled: :unset
432
- )
433
-
434
- context.update(
435
- friendly_name: friendly_name,
436
- identity: identity,
437
- deployment_sid: deployment_sid,
438
- enabled: enabled,
439
- )
440
- end
441
-
442
- ##
443
- # Provide a user friendly representation
444
- def to_s
445
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
446
- "<Twilio.Preview.DeployedDevices.DeviceInstance #{values}>"
447
- end
448
-
449
- ##
450
- # Provide a detailed, user friendly representation
451
- def inspect
452
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
453
- "<Twilio.Preview.DeployedDevices.DeviceInstance #{values}>"
454
- end
455
- end
456
-
457
- end
458
- end
459
- end
460
- end
461
- end
462
-
463
-