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,424 +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 CertificateList < ListResource
23
-
24
- ##
25
- # Initialize the CertificateList
26
- # @param [Version] version Version that contains the resource
27
- # @return [CertificateList] CertificateList
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]}/Certificates"
33
-
34
- end
35
- ##
36
- # Create the CertificateInstance
37
- # @param [String] certificate_data Provides a URL encoded representation of the public certificate in PEM format.
38
- # @param [String] friendly_name Provides a human readable descriptive text for this Certificate credential, up to 256 characters long.
39
- # @param [String] device_sid Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential.
40
- # @return [CertificateInstance] Created CertificateInstance
41
- def create(
42
- certificate_data: nil,
43
- friendly_name: :unset,
44
- device_sid: :unset
45
- )
46
-
47
- data = Twilio::Values.of({
48
- 'CertificateData' => certificate_data,
49
- 'FriendlyName' => friendly_name,
50
- 'DeviceSid' => device_sid,
51
- })
52
-
53
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
54
-
55
- payload = @version.create('POST', @uri, data: data, headers: headers)
56
- CertificateInstance.new(
57
- @version,
58
- payload,
59
- fleet_sid: @solution[:fleet_sid],
60
- )
61
- end
62
-
63
-
64
- ##
65
- # Lists CertificateInstance records from the API as a list.
66
- # Unlike stream(), this operation is eager and will load `limit` records into
67
- # memory before returning.
68
- # @param [String] device_sid Filters the resulting list of Certificates by a unique string identifier of an authenticated Device.
69
- # @param [Integer] limit Upper limit for the number of records to return. stream()
70
- # guarantees to never return more than limit. Default is no limit
71
- # @param [Integer] page_size Number of records to fetch per request, when
72
- # not set will use the default value of 50 records. If no page_size is defined
73
- # but a limit is defined, stream() will attempt to read the limit with the most
74
- # efficient page size, i.e. min(limit, 1000)
75
- # @return [Array] Array of up to limit results
76
- def list(device_sid: :unset, limit: nil, page_size: nil)
77
- self.stream(
78
- device_sid: device_sid,
79
- limit: limit,
80
- page_size: page_size
81
- ).entries
82
- end
83
-
84
- ##
85
- # Streams Instance records from the API as an Enumerable.
86
- # This operation lazily loads records as efficiently as possible until the limit
87
- # is reached.
88
- # @param [String] device_sid Filters the resulting list of Certificates by a unique string identifier of an authenticated Device.
89
- # @param [Integer] limit Upper limit for the number of records to return. stream()
90
- # guarantees to never return more than limit. Default is no limit
91
- # @param [Integer] page_size Number of records to fetch per request, when
92
- # not set will use the default value of 50 records. If no page_size is defined
93
- # but a limit is defined, stream() will attempt to read the limit with the most
94
- # efficient page size, i.e. min(limit, 1000)
95
- # @return [Enumerable] Enumerable that will yield up to limit results
96
- def stream(device_sid: :unset, limit: nil, page_size: nil)
97
- limits = @version.read_limits(limit, page_size)
98
-
99
- page = self.page(
100
- device_sid: device_sid,
101
- page_size: limits[:page_size], )
102
-
103
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
104
- end
105
-
106
- ##
107
- # When passed a block, yields CertificateInstance records from the API.
108
- # This operation lazily loads records as efficiently as possible until the limit
109
- # is reached.
110
- def each
111
- limits = @version.read_limits
112
-
113
- page = self.page(page_size: limits[:page_size], )
114
-
115
- @version.stream(page,
116
- limit: limits[:limit],
117
- page_limit: limits[:page_limit]).each {|x| yield x}
118
- end
119
-
120
- ##
121
- # Retrieve a single page of CertificateInstance records from the API.
122
- # Request is executed immediately.
123
- # @param [String] device_sid Filters the resulting list of Certificates by a unique string 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 CertificateInstance
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
-
136
- response = @version.page('GET', @uri, params: params)
137
-
138
- CertificatePage.new(@version, response, @solution)
139
- end
140
-
141
- ##
142
- # Retrieve a single page of CertificateInstance records from the API.
143
- # Request is executed immediately.
144
- # @param [String] target_url API-generated URL for the requested results page
145
- # @return [Page] Page of CertificateInstance
146
- def get_page(target_url)
147
- response = @version.domain.request(
148
- 'GET',
149
- target_url
150
- )
151
- CertificatePage.new(@version, response, @solution)
152
- end
153
-
154
-
155
-
156
- # Provide a user friendly representation
157
- def to_s
158
- '#<Twilio.Preview.DeployedDevices.CertificateList>'
159
- end
160
- end
161
-
162
-
163
- class CertificateContext < InstanceContext
164
- ##
165
- # Initialize the CertificateContext
166
- # @param [Version] version Version that contains the resource
167
- # @param [String] fleet_sid
168
- # @param [String] sid Provides a 34 character string that uniquely identifies the requested Certificate credential resource.
169
- # @return [CertificateContext] CertificateContext
170
- def initialize(version, fleet_sid, sid)
171
- super(version)
172
-
173
- # Path Solution
174
- @solution = { fleet_sid: fleet_sid, sid: sid, }
175
- @uri = "/Fleets/#{@solution[:fleet_sid]}/Certificates/#{@solution[:sid]}"
176
-
177
-
178
- end
179
- ##
180
- # Delete the CertificateInstance
181
- # @return [Boolean] True if delete succeeds, false otherwise
182
- def delete
183
-
184
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
185
-
186
- @version.delete('DELETE', @uri, headers: headers)
187
- end
188
-
189
- ##
190
- # Fetch the CertificateInstance
191
- # @return [CertificateInstance] Fetched CertificateInstance
192
- def fetch
193
-
194
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
195
-
196
- payload = @version.fetch('GET', @uri, headers: headers)
197
- CertificateInstance.new(
198
- @version,
199
- payload,
200
- fleet_sid: @solution[:fleet_sid],
201
- sid: @solution[:sid],
202
- )
203
- end
204
-
205
- ##
206
- # Update the CertificateInstance
207
- # @param [String] friendly_name Provides a human readable descriptive text for this Certificate credential, up to 256 characters long.
208
- # @param [String] device_sid Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential.
209
- # @return [CertificateInstance] Updated CertificateInstance
210
- def update(
211
- friendly_name: :unset,
212
- device_sid: :unset
213
- )
214
-
215
- data = Twilio::Values.of({
216
- 'FriendlyName' => friendly_name,
217
- 'DeviceSid' => device_sid,
218
- })
219
-
220
- headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
221
-
222
- payload = @version.update('POST', @uri, data: data, headers: headers)
223
- CertificateInstance.new(
224
- @version,
225
- payload,
226
- fleet_sid: @solution[:fleet_sid],
227
- sid: @solution[:sid],
228
- )
229
- end
230
-
231
-
232
- ##
233
- # Provide a user friendly representation
234
- def to_s
235
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
236
- "#<Twilio.Preview.DeployedDevices.CertificateContext #{context}>"
237
- end
238
-
239
- ##
240
- # Provide a detailed, user friendly representation
241
- def inspect
242
- context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
243
- "#<Twilio.Preview.DeployedDevices.CertificateContext #{context}>"
244
- end
245
- end
246
-
247
- class CertificatePage < Page
248
- ##
249
- # Initialize the CertificatePage
250
- # @param [Version] version Version that contains the resource
251
- # @param [Response] response Response from the API
252
- # @param [Hash] solution Path solution for the resource
253
- # @return [CertificatePage] CertificatePage
254
- def initialize(version, response, solution)
255
- super(version, response)
256
-
257
- # Path Solution
258
- @solution = solution
259
- end
260
-
261
- ##
262
- # Build an instance of CertificateInstance
263
- # @param [Hash] payload Payload response from the API
264
- # @return [CertificateInstance] CertificateInstance
265
- def get_instance(payload)
266
- CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid])
267
- end
268
-
269
- ##
270
- # Provide a user friendly representation
271
- def to_s
272
- '<Twilio.Preview.DeployedDevices.CertificatePage>'
273
- end
274
- end
275
- class CertificateInstance < InstanceResource
276
- ##
277
- # Initialize the CertificateInstance
278
- # @param [Version] version Version that contains the resource
279
- # @param [Hash] payload payload that contains response from Twilio
280
- # @param [String] account_sid The SID of the
281
- # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Certificate
282
- # resource.
283
- # @param [String] sid The SID of the Call resource to fetch.
284
- # @return [CertificateInstance] CertificateInstance
285
- def initialize(version, payload , fleet_sid: nil, sid: nil)
286
- super(version)
287
-
288
- # Marshaled Properties
289
- @properties = {
290
- 'sid' => payload['sid'],
291
- 'url' => payload['url'],
292
- 'friendly_name' => payload['friendly_name'],
293
- 'fleet_sid' => payload['fleet_sid'],
294
- 'account_sid' => payload['account_sid'],
295
- 'device_sid' => payload['device_sid'],
296
- 'thumbprint' => payload['thumbprint'],
297
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
298
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
299
- }
300
-
301
- # Context
302
- @instance_context = nil
303
- @params = { 'fleet_sid' => fleet_sid || @properties['fleet_sid'] ,'sid' => sid || @properties['sid'] , }
304
- end
305
-
306
- ##
307
- # Generate an instance context for the instance, the context is capable of
308
- # performing various actions. All instance actions are proxied to the context
309
- # @return [CertificateContext] CallContext for this CallInstance
310
- def context
311
- unless @instance_context
312
- @instance_context = CertificateContext.new(@version , @params['fleet_sid'], @params['sid'])
313
- end
314
- @instance_context
315
- end
316
-
317
- ##
318
- # @return [String] Contains a 34 character string that uniquely identifies this Certificate credential resource.
319
- def sid
320
- @properties['sid']
321
- end
322
-
323
- ##
324
- # @return [String] Contains an absolute URL for this Certificate credential resource.
325
- def url
326
- @properties['url']
327
- end
328
-
329
- ##
330
- # @return [String] Contains a human readable descriptive text for this Certificate credential, up to 256 characters long.
331
- def friendly_name
332
- @properties['friendly_name']
333
- end
334
-
335
- ##
336
- # @return [String] Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to.
337
- def fleet_sid
338
- @properties['fleet_sid']
339
- end
340
-
341
- ##
342
- # @return [String] Specifies the unique string identifier of the Account responsible for this Certificate credential.
343
- def account_sid
344
- @properties['account_sid']
345
- end
346
-
347
- ##
348
- # @return [String] Specifies the unique string identifier of a Device authenticated with this Certificate credential.
349
- def device_sid
350
- @properties['device_sid']
351
- end
352
-
353
- ##
354
- # @return [String] Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device.
355
- def thumbprint
356
- @properties['thumbprint']
357
- end
358
-
359
- ##
360
- # @return [Time] Specifies the date this Certificate credential was created, given in UTC ISO 8601 format.
361
- def date_created
362
- @properties['date_created']
363
- end
364
-
365
- ##
366
- # @return [Time] Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format.
367
- def date_updated
368
- @properties['date_updated']
369
- end
370
-
371
- ##
372
- # Delete the CertificateInstance
373
- # @return [Boolean] True if delete succeeds, false otherwise
374
- def delete
375
-
376
- context.delete
377
- end
378
-
379
- ##
380
- # Fetch the CertificateInstance
381
- # @return [CertificateInstance] Fetched CertificateInstance
382
- def fetch
383
-
384
- context.fetch
385
- end
386
-
387
- ##
388
- # Update the CertificateInstance
389
- # @param [String] friendly_name Provides a human readable descriptive text for this Certificate credential, up to 256 characters long.
390
- # @param [String] device_sid Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential.
391
- # @return [CertificateInstance] Updated CertificateInstance
392
- def update(
393
- friendly_name: :unset,
394
- device_sid: :unset
395
- )
396
-
397
- context.update(
398
- friendly_name: friendly_name,
399
- device_sid: device_sid,
400
- )
401
- end
402
-
403
- ##
404
- # Provide a user friendly representation
405
- def to_s
406
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
407
- "<Twilio.Preview.DeployedDevices.CertificateInstance #{values}>"
408
- end
409
-
410
- ##
411
- # Provide a detailed, user friendly representation
412
- def inspect
413
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
414
- "<Twilio.Preview.DeployedDevices.CertificateInstance #{values}>"
415
- end
416
- end
417
-
418
- end
419
- end
420
- end
421
- end
422
- end
423
-
424
-