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