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