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