twilio-ruby 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,348 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Numbers
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 Numbers < NumbersBase
19
+ class V2 < Version
20
+ class AuthorizationDocumentContext < InstanceContext
21
+
22
+ class DependentHostedNumberOrderList < ListResource
23
+ ##
24
+ # Initialize the DependentHostedNumberOrderList
25
+ # @param [Version] version Version that contains the resource
26
+ # @return [DependentHostedNumberOrderList] DependentHostedNumberOrderList
27
+ def initialize(version, signing_document_sid: nil)
28
+ super(version)
29
+ # Path Solution
30
+ @solution = { signing_document_sid: signing_document_sid }
31
+ @uri = "/HostedNumber/AuthorizationDocuments/#{@solution[:signing_document_sid]}/DependentHostedNumberOrders"
32
+
33
+ end
34
+
35
+ ##
36
+ # Lists DependentHostedNumberOrderInstance records from the API as a list.
37
+ # Unlike stream(), this operation is eager and will load `limit` records into
38
+ # memory before returning.
39
+ # @param [Status] status Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses.
40
+ # @param [String] phone_number An E164 formatted phone number hosted by this HostedNumberOrder.
41
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
42
+ # @param [String] friendly_name A human readable description of this resource, up to 64 characters.
43
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
44
+ # guarantees to never return more than limit. Default is no limit
45
+ # @param [Integer] page_size Number of records to fetch per request, when
46
+ # not set will use the default value of 50 records. If no page_size is defined
47
+ # but a limit is defined, stream() will attempt to read the limit with the most
48
+ # efficient page size, i.e. min(limit, 1000)
49
+ # @return [Array] Array of up to limit results
50
+ def list(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, limit: nil, page_size: nil)
51
+ self.stream(
52
+ status: status,
53
+ phone_number: phone_number,
54
+ incoming_phone_number_sid: incoming_phone_number_sid,
55
+ friendly_name: friendly_name,
56
+ limit: limit,
57
+ page_size: page_size
58
+ ).entries
59
+ end
60
+
61
+ ##
62
+ # Streams Instance records from the API as an Enumerable.
63
+ # This operation lazily loads records as efficiently as possible until the limit
64
+ # is reached.
65
+ # @param [Status] status Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses.
66
+ # @param [String] phone_number An E164 formatted phone number hosted by this HostedNumberOrder.
67
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
68
+ # @param [String] friendly_name A human readable description of this resource, up to 64 characters.
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 [Enumerable] Enumerable that will yield up to limit results
76
+ def stream(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, limit: nil, page_size: nil)
77
+ limits = @version.read_limits(limit, page_size)
78
+
79
+ page = self.page(
80
+ status: status,
81
+ phone_number: phone_number,
82
+ incoming_phone_number_sid: incoming_phone_number_sid,
83
+ friendly_name: friendly_name,
84
+ page_size: limits[:page_size], )
85
+
86
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
87
+ end
88
+
89
+ ##
90
+ # When passed a block, yields DependentHostedNumberOrderInstance records from the API.
91
+ # This operation lazily loads records as efficiently as possible until the limit
92
+ # is reached.
93
+ def each
94
+ limits = @version.read_limits
95
+
96
+ page = self.page(page_size: limits[:page_size], )
97
+
98
+ @version.stream(page,
99
+ limit: limits[:limit],
100
+ page_limit: limits[:page_limit]).each {|x| yield x}
101
+ end
102
+
103
+ ##
104
+ # Retrieve a single page of DependentHostedNumberOrderInstance records from the API.
105
+ # Request is executed immediately.
106
+ # @param [Status] status Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents#status-values) for more information on each of these statuses.
107
+ # @param [String] phone_number An E164 formatted phone number hosted by this HostedNumberOrder.
108
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
109
+ # @param [String] friendly_name A human readable description of this resource, up to 64 characters.
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 DependentHostedNumberOrderInstance
114
+ def page(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
115
+ params = Twilio::Values.of({
116
+
117
+ 'Status' => status,
118
+
119
+ 'PhoneNumber' => phone_number,
120
+
121
+ 'IncomingPhoneNumberSid' => incoming_phone_number_sid,
122
+
123
+ 'FriendlyName' => friendly_name,
124
+
125
+ 'PageToken' => page_token,
126
+ 'Page' => page_number,
127
+ 'PageSize' => page_size,
128
+ })
129
+
130
+ response = @version.page('GET', @uri, params: params)
131
+
132
+ DependentHostedNumberOrderPage.new(@version, response, @solution)
133
+ end
134
+
135
+ ##
136
+ # Retrieve a single page of DependentHostedNumberOrderInstance records from the API.
137
+ # Request is executed immediately.
138
+ # @param [String] target_url API-generated URL for the requested results page
139
+ # @return [Page] Page of DependentHostedNumberOrderInstance
140
+ def get_page(target_url)
141
+ response = @version.domain.request(
142
+ 'GET',
143
+ target_url
144
+ )
145
+ DependentHostedNumberOrderPage.new(@version, response, @solution)
146
+ end
147
+
148
+
149
+
150
+ # Provide a user friendly representation
151
+ def to_s
152
+ '#<Twilio.Numbers.V2.DependentHostedNumberOrderList>'
153
+ end
154
+ end
155
+
156
+ class DependentHostedNumberOrderPage < Page
157
+ ##
158
+ # Initialize the DependentHostedNumberOrderPage
159
+ # @param [Version] version Version that contains the resource
160
+ # @param [Response] response Response from the API
161
+ # @param [Hash] solution Path solution for the resource
162
+ # @return [DependentHostedNumberOrderPage] DependentHostedNumberOrderPage
163
+ def initialize(version, response, solution)
164
+ super(version, response)
165
+
166
+ # Path Solution
167
+ @solution = solution
168
+ end
169
+
170
+ ##
171
+ # Build an instance of DependentHostedNumberOrderInstance
172
+ # @param [Hash] payload Payload response from the API
173
+ # @return [DependentHostedNumberOrderInstance] DependentHostedNumberOrderInstance
174
+ def get_instance(payload)
175
+ DependentHostedNumberOrderInstance.new(@version, payload, signing_document_sid: @solution[:signing_document_sid])
176
+ end
177
+
178
+ ##
179
+ # Provide a user friendly representation
180
+ def to_s
181
+ '<Twilio.Numbers.V2.DependentHostedNumberOrderPage>'
182
+ end
183
+ end
184
+ class DependentHostedNumberOrderInstance < InstanceResource
185
+ ##
186
+ # Initialize the DependentHostedNumberOrderInstance
187
+ # @param [Version] version Version that contains the resource
188
+ # @param [Hash] payload payload that contains response from Twilio
189
+ # @param [String] account_sid The SID of the
190
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this DependentHostedNumberOrder
191
+ # resource.
192
+ # @param [String] sid The SID of the Call resource to fetch.
193
+ # @return [DependentHostedNumberOrderInstance] DependentHostedNumberOrderInstance
194
+ def initialize(version, payload , signing_document_sid: nil)
195
+ super(version)
196
+
197
+ # Marshaled Properties
198
+ @properties = {
199
+ 'sid' => payload['sid'],
200
+ 'bulk_hosting_request_sid' => payload['bulk_hosting_request_sid'],
201
+ 'next_step' => payload['next_step'],
202
+ 'account_sid' => payload['account_sid'],
203
+ 'incoming_phone_number_sid' => payload['incoming_phone_number_sid'],
204
+ 'address_sid' => payload['address_sid'],
205
+ 'signing_document_sid' => payload['signing_document_sid'],
206
+ 'phone_number' => payload['phone_number'],
207
+ 'capabilities' => payload['capabilities'],
208
+ 'friendly_name' => payload['friendly_name'],
209
+ 'status' => payload['status'],
210
+ 'failure_reason' => payload['failure_reason'],
211
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
212
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
213
+ 'email' => payload['email'],
214
+ 'cc_emails' => payload['cc_emails'],
215
+ 'contact_title' => payload['contact_title'],
216
+ 'contact_phone_number' => payload['contact_phone_number'],
217
+ }
218
+ end
219
+
220
+
221
+ ##
222
+ # @return [String] A 34 character string that uniquely identifies this Authorization Document
223
+ def sid
224
+ @properties['sid']
225
+ end
226
+
227
+ ##
228
+ # @return [String] A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder.
229
+ def bulk_hosting_request_sid
230
+ @properties['bulk_hosting_request_sid']
231
+ end
232
+
233
+ ##
234
+ # @return [String] The next step you need to take to complete the hosted number order and request it successfully.
235
+ def next_step
236
+ @properties['next_step']
237
+ end
238
+
239
+ ##
240
+ # @return [String] The unique SID identifier of the Account.
241
+ def account_sid
242
+ @properties['account_sid']
243
+ end
244
+
245
+ ##
246
+ # @return [String] A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
247
+ def incoming_phone_number_sid
248
+ @properties['incoming_phone_number_sid']
249
+ end
250
+
251
+ ##
252
+ # @return [String] A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
253
+ def address_sid
254
+ @properties['address_sid']
255
+ end
256
+
257
+ ##
258
+ # @return [String] A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder.
259
+ def signing_document_sid
260
+ @properties['signing_document_sid']
261
+ end
262
+
263
+ ##
264
+ # @return [String] An E164 formatted phone number hosted by this HostedNumberOrder.
265
+ def phone_number
266
+ @properties['phone_number']
267
+ end
268
+
269
+ ##
270
+ # @return [NumbersV2AuthorizationDocumentDependentHostedNumberOrderCapabilities]
271
+ def capabilities
272
+ @properties['capabilities']
273
+ end
274
+
275
+ ##
276
+ # @return [String] A human readable description of this resource, up to 64 characters.
277
+ def friendly_name
278
+ @properties['friendly_name']
279
+ end
280
+
281
+ ##
282
+ # @return [Status]
283
+ def status
284
+ @properties['status']
285
+ end
286
+
287
+ ##
288
+ # @return [String] A message that explains why a hosted_number_order went to status \"action-required\"
289
+ def failure_reason
290
+ @properties['failure_reason']
291
+ end
292
+
293
+ ##
294
+ # @return [Time] The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
295
+ def date_created
296
+ @properties['date_created']
297
+ end
298
+
299
+ ##
300
+ # @return [Time] The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
301
+ def date_updated
302
+ @properties['date_updated']
303
+ end
304
+
305
+ ##
306
+ # @return [String] Email of the owner of this phone number that is being hosted.
307
+ def email
308
+ @properties['email']
309
+ end
310
+
311
+ ##
312
+ # @return [Array<String>] Email recipients who will be informed when an Authorization Document has been sent and signed
313
+ def cc_emails
314
+ @properties['cc_emails']
315
+ end
316
+
317
+ ##
318
+ # @return [String] The title of the person authorized to sign the Authorization Document for this phone number.
319
+ def contact_title
320
+ @properties['contact_title']
321
+ end
322
+
323
+ ##
324
+ # @return [String] The contact phone number of the person authorized to sign the Authorization Document.
325
+ def contact_phone_number
326
+ @properties['contact_phone_number']
327
+ end
328
+
329
+ ##
330
+ # Provide a user friendly representation
331
+ def to_s
332
+ "<Twilio.Numbers.V2.DependentHostedNumberOrderInstance>"
333
+ end
334
+
335
+ ##
336
+ # Provide a detailed, user friendly representation
337
+ def inspect
338
+ "<Twilio.Numbers.V2.DependentHostedNumberOrderInstance>"
339
+ end
340
+ end
341
+
342
+ end
343
+ end
344
+ end
345
+ end
346
+ end
347
+
348
+