twilio-ruby 5.0.0.rc20 → 5.0.0.rc21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +9 -3
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/http/http_client.rb +0 -1
  5. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +196 -0
  6. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +197 -0
  7. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +232 -0
  8. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +44 -0
  9. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +517 -0
  10. data/lib/twilio-ruby/rest/preview/hosted_numbers.rb +35 -0
  11. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +336 -0
  12. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +393 -0
  13. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +409 -0
  14. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +479 -0
  15. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +506 -0
  16. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +336 -0
  17. data/lib/twilio-ruby/rest/preview/proxy/service.rb +467 -0
  18. data/lib/twilio-ruby/rest/preview/proxy.rb +35 -0
  19. data/lib/twilio-ruby/rest/preview.rb +34 -1
  20. data/lib/twilio-ruby/version.rb +1 -1
  21. data/spec/integration/preview/bulk_exports/export/day_spec.rb +56 -0
  22. data/spec/integration/preview/bulk_exports/export_configuration_spec.rb +79 -0
  23. data/spec/integration/preview/bulk_exports/export_spec.rb +43 -0
  24. data/spec/integration/preview/hosted_numbers/hosted_number_order_spec.rb +277 -0
  25. data/spec/integration/preview/proxy/service/phone_number_spec.rb +173 -0
  26. data/spec/integration/preview/proxy/service/session/interaction_spec.rb +104 -0
  27. data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +164 -0
  28. data/spec/integration/preview/proxy/service/session/participant_spec.rb +226 -0
  29. data/spec/integration/preview/proxy/service/session_spec.rb +216 -0
  30. data/spec/integration/preview/proxy/service/short_code_spec.rb +173 -0
  31. data/spec/integration/preview/proxy/service_spec.rb +200 -0
  32. metadata +38 -2
@@ -0,0 +1,232 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class BulkExports < Version
11
+ class ExportConfigurationList < ListResource
12
+ ##
13
+ # Initialize the ExportConfigurationList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [ExportConfigurationList] ExportConfigurationList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ end
22
+
23
+ ##
24
+ # Provide a user friendly representation
25
+ def to_s
26
+ '#<Twilio.Preview.BulkExports.ExportConfigurationList>'
27
+ end
28
+ end
29
+
30
+ class ExportConfigurationPage < Page
31
+ ##
32
+ # Initialize the ExportConfigurationPage
33
+ # @param [Version] version Version that contains the resource
34
+ # @param [Response] response Response from the API
35
+ # @param [Hash] solution Path solution for the resource
36
+ # @return [ExportConfigurationPage] ExportConfigurationPage
37
+ def initialize(version, response, solution)
38
+ super(version, response)
39
+
40
+ # Path Solution
41
+ @solution = solution
42
+ end
43
+
44
+ ##
45
+ # Build an instance of ExportConfigurationInstance
46
+ # @param [Hash] payload Payload response from the API
47
+ # @return [ExportConfigurationInstance] ExportConfigurationInstance
48
+ def get_instance(payload)
49
+ return ExportConfigurationInstance.new(
50
+ @version,
51
+ payload,
52
+ )
53
+ end
54
+
55
+ ##
56
+ # Provide a user friendly representation
57
+ def to_s
58
+ '<Twilio.Preview.BulkExports.ExportConfigurationPage>'
59
+ end
60
+ end
61
+
62
+ class ExportConfigurationContext < InstanceContext
63
+ ##
64
+ # Initialize the ExportConfigurationContext
65
+ # @param [Version] version Version that contains the resource
66
+ # @param [String] resource_type The resource_type
67
+ # @return [ExportConfigurationContext] ExportConfigurationContext
68
+ def initialize(version, resource_type)
69
+ super(version)
70
+
71
+ # Path Solution
72
+ @solution = {
73
+ resource_type: resource_type,
74
+ }
75
+ @uri = "/Exports/#{@solution[:resource_type]}/Configuration"
76
+ end
77
+
78
+ ##
79
+ # Fetch a ExportConfigurationInstance
80
+ # @return [ExportConfigurationInstance] Fetched ExportConfigurationInstance
81
+ def fetch
82
+ params = {}
83
+
84
+ payload = @version.fetch(
85
+ 'GET',
86
+ @uri,
87
+ params,
88
+ )
89
+
90
+ return ExportConfigurationInstance.new(
91
+ @version,
92
+ payload,
93
+ resource_type: @solution[:resource_type],
94
+ )
95
+ end
96
+
97
+ ##
98
+ # Update the ExportConfigurationInstance
99
+ # @param [Boolean] enabled The enabled
100
+ # @param [String] webhook_url The webhook_url
101
+ # @param [String] webhook_method The webhook_method
102
+ # @param [String] email The email
103
+ # @return [ExportConfigurationInstance] Updated ExportConfigurationInstance
104
+ def update(enabled: nil, webhook_url: nil, webhook_method: nil, email: nil)
105
+ data = {
106
+ 'Enabled' => enabled,
107
+ 'WebhookUrl' => webhook_url,
108
+ 'WebhookMethod' => webhook_method,
109
+ 'Email' => email,
110
+ }
111
+
112
+ payload = @version.update(
113
+ 'POST',
114
+ @uri,
115
+ data: data,
116
+ )
117
+
118
+ return ExportConfigurationInstance.new(
119
+ @version,
120
+ payload,
121
+ resource_type: @solution[:resource_type],
122
+ )
123
+ end
124
+
125
+ ##
126
+ # Provide a user friendly representation
127
+ def to_s
128
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
129
+ "#<Twilio.Preview.BulkExports.ExportConfigurationContext #{context}>"
130
+ end
131
+ end
132
+
133
+ class ExportConfigurationInstance < InstanceResource
134
+ ##
135
+ # Initialize the ExportConfigurationInstance
136
+ # @param [Version] version Version that contains the resource
137
+ # @param [Hash] payload payload that contains response from Twilio
138
+ # @param [String] resource_type The resource_type
139
+ # @return [ExportConfigurationInstance] ExportConfigurationInstance
140
+ def initialize(version, payload, resource_type: nil)
141
+ super(version)
142
+
143
+ # Marshaled Properties
144
+ @properties = {
145
+ 'enabled' => payload['enabled'],
146
+ 'webhook_url' => payload['webhook_url'],
147
+ 'webhook_method' => payload['webhook_method'],
148
+ 'email' => payload['email'],
149
+ 'resource_type' => payload['resource_type'],
150
+ 'url' => payload['url'],
151
+ }
152
+
153
+ # Context
154
+ @instance_context = nil
155
+ @params = {
156
+ 'resource_type' => resource_type || @properties['resource_type'],
157
+ }
158
+ end
159
+
160
+ ##
161
+ # Generate an instance context for the instance, the context is capable of
162
+ # performing various actions. All instance actions are proxied to the context
163
+ # @param [Version] version Version that contains the resource
164
+ # @return [ExportConfigurationContext] ExportConfigurationContext for this ExportConfigurationInstance
165
+ def context
166
+ unless @instance_context
167
+ @instance_context = ExportConfigurationContext.new(
168
+ @version,
169
+ @params['resource_type'],
170
+ )
171
+ end
172
+ @instance_context
173
+ end
174
+
175
+ def enabled
176
+ @properties['enabled']
177
+ end
178
+
179
+ def webhook_url
180
+ @properties['webhook_url']
181
+ end
182
+
183
+ def webhook_method
184
+ @properties['webhook_method']
185
+ end
186
+
187
+ def email
188
+ @properties['email']
189
+ end
190
+
191
+ def resource_type
192
+ @properties['resource_type']
193
+ end
194
+
195
+ def url
196
+ @properties['url']
197
+ end
198
+
199
+ ##
200
+ # Fetch a ExportConfigurationInstance
201
+ # @return [ExportConfigurationInstance] Fetched ExportConfigurationInstance
202
+ def fetch
203
+ context.fetch
204
+ end
205
+
206
+ ##
207
+ # Update the ExportConfigurationInstance
208
+ # @param [Boolean] enabled The enabled
209
+ # @param [String] webhook_url The webhook_url
210
+ # @param [String] webhook_method The webhook_method
211
+ # @param [String] email The email
212
+ # @return [ExportConfigurationInstance] Updated ExportConfigurationInstance
213
+ def update(enabled: nil, webhook_url: nil, webhook_method: nil, email: nil)
214
+ context.update(
215
+ enabled: enabled,
216
+ webhook_url: webhook_url,
217
+ webhook_method: webhook_method,
218
+ email: email,
219
+ )
220
+ end
221
+
222
+ ##
223
+ # Provide a user friendly representation
224
+ def to_s
225
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
226
+ "<Twilio.Preview.BulkExports.ExportConfigurationInstance #{values}>"
227
+ end
228
+ end
229
+ end
230
+ end
231
+ end
232
+ end
@@ -0,0 +1,44 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview
10
+ class BulkExports < Version
11
+ ##
12
+ # Initialize the BulkExports version of Preview
13
+ def initialize(domain)
14
+ super
15
+ @version = 'BulkExports'
16
+ @exports = nil
17
+ @export_configuration = nil
18
+ end
19
+
20
+ def exports(sid=:unset)
21
+ if sid == :unset
22
+ @exports ||= ExportList.new self
23
+ else
24
+ ExportContext.new(self, sid)
25
+ end
26
+ end
27
+
28
+ def export_configuration(sid=:unset)
29
+ if sid == :unset
30
+ @export_configuration ||= ExportConfigurationList.new self
31
+ else
32
+ ExportConfigurationContext.new(self, sid)
33
+ end
34
+ end
35
+
36
+ ##
37
+ # Provide a user friendly representation
38
+ def to_s
39
+ '<Twilio::REST::Preview::BulkExports>'
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,517 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class HostedNumbers < Version
11
+ class HostedNumberOrderList < ListResource
12
+ ##
13
+ # Initialize the HostedNumberOrderList
14
+ # @param [Version] version Version that contains the resource
15
+ # @return [HostedNumberOrderList] HostedNumberOrderList
16
+ def initialize(version)
17
+ super(version)
18
+
19
+ # Path Solution
20
+ @solution = {}
21
+ @uri = "/HostedNumberOrders"
22
+ end
23
+
24
+ ##
25
+ # Lists HostedNumberOrderInstance records from the API as a list.
26
+ # Unlike stream(), this operation is eager and will load `limit` records into
27
+ # memory before returning.
28
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
29
+ # One of `received`, `pending-loa`, `carrier-processing`, `testing`, `completed`,
30
+ # `failed`, or `action-required`.
31
+ # @param [String] phone_number An E164 formatted phone number hosted by this
32
+ # HostedNumberOrder.
33
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely
34
+ # identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
35
+ # @param [String] friendly_name A human readable description of this resource, up
36
+ # to 64 characters.
37
+ # @param [String] unique_name Provides a unique and addressable name to be
38
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
39
+ # used in addition to SID.
40
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
41
+ # guarantees to never return more than limit. Default is no limit
42
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
43
+ # the default value of 50 records. If no page_size is defined
44
+ # but a limit is defined, stream() will attempt to read the
45
+ # limit with the most efficient page size, i.e. min(limit, 1000)
46
+ # @return [Array] Array of up to limit results
47
+ def list(status: nil, phone_number: nil, incoming_phone_number_sid: nil, friendly_name: nil, unique_name: nil, limit: nil, page_size: nil)
48
+ self.stream(
49
+ status: status,
50
+ phone_number: phone_number,
51
+ incoming_phone_number_sid: incoming_phone_number_sid,
52
+ friendly_name: friendly_name,
53
+ unique_name: unique_name,
54
+ limit: limit,
55
+ page_size: page_size
56
+ ).entries
57
+ end
58
+
59
+ ##
60
+ # Streams HostedNumberOrderInstance records from the API as an Enumerable.
61
+ # This operation lazily loads records as efficiently as possible until the limit
62
+ # is reached.
63
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
64
+ # One of `received`, `pending-loa`, `carrier-processing`, `testing`, `completed`,
65
+ # `failed`, or `action-required`.
66
+ # @param [String] phone_number An E164 formatted phone number hosted by this
67
+ # HostedNumberOrder.
68
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely
69
+ # identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
70
+ # @param [String] friendly_name A human readable description of this resource, up
71
+ # to 64 characters.
72
+ # @param [String] unique_name Provides a unique and addressable name to be
73
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
74
+ # used in addition to SID.
75
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
76
+ # guarantees to never return more than limit. Default is no limit
77
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
78
+ # the default value of 50 records. If no page_size is defined
79
+ # but a limit is defined, stream() will attempt to read the
80
+ # limit with the most efficient page size, i.e. min(limit, 1000)
81
+ # @return [Enumerable] Enumerable that will yield up to limit results
82
+ def stream(status: nil, phone_number: nil, incoming_phone_number_sid: nil, friendly_name: nil, unique_name: nil, limit: nil, page_size: nil)
83
+ limits = @version.read_limits(limit, page_size)
84
+
85
+ page = self.page(
86
+ status: status,
87
+ phone_number: phone_number,
88
+ incoming_phone_number_sid: incoming_phone_number_sid,
89
+ friendly_name: friendly_name,
90
+ unique_name: unique_name,
91
+ page_size: limits[:page_size],
92
+ )
93
+
94
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
95
+ end
96
+
97
+ ##
98
+ # When passed a block, yields HostedNumberOrderInstance records from the API.
99
+ # This operation lazily loads records as efficiently as possible until the limit
100
+ # is reached.
101
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
102
+ # One of `received`, `pending-loa`, `carrier-processing`, `testing`, `completed`,
103
+ # `failed`, or `action-required`.
104
+ # @param [String] phone_number An E164 formatted phone number hosted by this
105
+ # HostedNumberOrder.
106
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely
107
+ # identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
108
+ # @param [String] friendly_name A human readable description of this resource, up
109
+ # to 64 characters.
110
+ # @param [String] unique_name Provides a unique and addressable name to be
111
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
112
+ # used in addition to SID.
113
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
114
+ # guarantees to never return more than limit. Default is no limit
115
+ # @param [Integer] page_size Number of records to fetch per request, when not set will use
116
+ # the default value of 50 records. If no page_size is defined
117
+ # but a limit is defined, stream() will attempt to read the
118
+ # limit with the most efficient page size, i.e. min(limit, 1000)
119
+ def each
120
+ limits = @version.read_limits
121
+
122
+ page = self.page(
123
+ page_size: limits[:page_size],
124
+ )
125
+
126
+ @version.stream(page,
127
+ limit: limits[:limit],
128
+ page_limit: limits[:page_limit]).each {|x| yield x}
129
+ end
130
+
131
+ ##
132
+ # Retrieve a single page of HostedNumberOrderInstance records from the API.
133
+ # Request is executed immediately.
134
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
135
+ # One of `received`, `pending-loa`, `carrier-processing`, `testing`, `completed`,
136
+ # `failed`, or `action-required`.
137
+ # @param [String] phone_number An E164 formatted phone number hosted by this
138
+ # HostedNumberOrder.
139
+ # @param [String] incoming_phone_number_sid A 34 character string that uniquely
140
+ # identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
141
+ # @param [String] friendly_name A human readable description of this resource, up
142
+ # to 64 characters.
143
+ # @param [String] unique_name Provides a unique and addressable name to be
144
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
145
+ # used in addition to SID.
146
+ # @param [String] page_token PageToken provided by the API
147
+ # @param [Integer] page_number Page Number, this value is simply for client state
148
+ # @param [Integer] page_size Number of records to return, defaults to 50
149
+ # @return [Page] Page of HostedNumberOrderInstance
150
+ def page(status: nil, phone_number: nil, incoming_phone_number_sid: nil, friendly_name: nil, unique_name: nil, page_token: nil, page_number: nil, page_size: nil)
151
+ params = {
152
+ 'Status' => status,
153
+ 'PhoneNumber' => phone_number,
154
+ 'IncomingPhoneNumberSid' => incoming_phone_number_sid,
155
+ 'FriendlyName' => friendly_name,
156
+ 'UniqueName' => unique_name,
157
+ 'PageToken' => page_token,
158
+ 'Page' => page_number,
159
+ 'PageSize' => page_size,
160
+ }
161
+ response = @version.page(
162
+ 'GET',
163
+ @uri,
164
+ params
165
+ )
166
+ return HostedNumberOrderPage.new(@version, response, @solution)
167
+ end
168
+
169
+ ##
170
+ # Retrieve a single page of HostedNumberOrderInstance records from the API.
171
+ # Request is executed immediately.
172
+ # @param [String] address_sid A 34 character string that uniquely identifies the
173
+ # Address resource that represents the address of the owner of this phone number.
174
+ # @param [String] phone_number An E164 formatted phone number hosted by this
175
+ # HostedNumberOrder.
176
+ # @param [hosted_number_order.Type] type The type of the phone_number. One of
177
+ # `local` or `tollfree`.
178
+ # @param [String] iso_country The ISO country code of the phone_number.
179
+ # @param [Boolean] sms_capability Used to specify that the SMS capability will be
180
+ # hosted on Twilio's platform.
181
+ # @param [String] email Email of the owner of this phone number that is being
182
+ # hosted.
183
+ # @param [String] account_sid Optional. The unique SID identifier of the Account
184
+ # or Sub-Account to create this HostedNumberOrder on.
185
+ # @param [String] friendly_name Optional. A human readable description of this
186
+ # resource, up to 64 characters.
187
+ # @param [String] unique_name Optional. Provides a unique and addressable name to
188
+ # be assigned to this HostedNumberOrder, assigned by the developer, to be
189
+ # optionally used in addition to SID.
190
+ # @param [String] cc_emails Optional. A list of emails that LOA document for this
191
+ # HostedNumberOrder will be carbon copied to.
192
+ # @param [String] sms_url Optional. The SMS URL attached to the
193
+ # IncomingPhoneNumber resource.
194
+ # @param [String] sms_method Optional. The SMS Method attached to the
195
+ # IncomingPhoneNumber resource.
196
+ # @param [String] sms_fallback_url Optional. The SMS Fallback URL attached to the
197
+ # IncomingPhoneNumber resource.
198
+ # @param [String] sms_fallback_method Optional. The SMS Fallback Method attached
199
+ # to the IncomingPhoneNumber resource.
200
+ # @return [HostedNumberOrderInstance] Newly created HostedNumberOrderInstance
201
+ def create(address_sid: nil, phone_number: nil, type: nil, iso_country: nil, sms_capability: nil, email: nil, account_sid: nil, friendly_name: nil, unique_name: nil, cc_emails: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil)
202
+ data = {
203
+ 'AddressSid' => address_sid,
204
+ 'PhoneNumber' => phone_number,
205
+ 'Type' => type,
206
+ 'IsoCountry' => iso_country,
207
+ 'SmsCapability' => sms_capability,
208
+ 'Email' => email,
209
+ 'AccountSid' => account_sid,
210
+ 'FriendlyName' => friendly_name,
211
+ 'UniqueName' => unique_name,
212
+ 'CcEmails' => cc_emails,
213
+ 'SmsUrl' => sms_url,
214
+ 'SmsMethod' => sms_method,
215
+ 'SmsFallbackUrl' => sms_fallback_url,
216
+ 'SmsFallbackMethod' => sms_fallback_method,
217
+ }
218
+
219
+ payload = @version.create(
220
+ 'POST',
221
+ @uri,
222
+ data: data
223
+ )
224
+
225
+ return HostedNumberOrderInstance.new(
226
+ @version,
227
+ payload,
228
+ )
229
+ end
230
+
231
+ ##
232
+ # Provide a user friendly representation
233
+ def to_s
234
+ '#<Twilio.Preview.HostedNumbers.HostedNumberOrderList>'
235
+ end
236
+ end
237
+
238
+ class HostedNumberOrderPage < Page
239
+ ##
240
+ # Initialize the HostedNumberOrderPage
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 [HostedNumberOrderPage] HostedNumberOrderPage
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 HostedNumberOrderInstance
254
+ # @param [Hash] payload Payload response from the API
255
+ # @return [HostedNumberOrderInstance] HostedNumberOrderInstance
256
+ def get_instance(payload)
257
+ return HostedNumberOrderInstance.new(
258
+ @version,
259
+ payload,
260
+ )
261
+ end
262
+
263
+ ##
264
+ # Provide a user friendly representation
265
+ def to_s
266
+ '<Twilio.Preview.HostedNumbers.HostedNumberOrderPage>'
267
+ end
268
+ end
269
+
270
+ class HostedNumberOrderContext < InstanceContext
271
+ ##
272
+ # Initialize the HostedNumberOrderContext
273
+ # @param [Version] version Version that contains the resource
274
+ # @param [String] sid A 34 character string that uniquely identifies this
275
+ # HostedNumberOrder.
276
+ # @return [HostedNumberOrderContext] HostedNumberOrderContext
277
+ def initialize(version, sid)
278
+ super(version)
279
+
280
+ # Path Solution
281
+ @solution = {
282
+ sid: sid,
283
+ }
284
+ @uri = "/HostedNumberOrders/#{@solution[:sid]}"
285
+ end
286
+
287
+ ##
288
+ # Fetch a HostedNumberOrderInstance
289
+ # @return [HostedNumberOrderInstance] Fetched HostedNumberOrderInstance
290
+ def fetch
291
+ params = {}
292
+
293
+ payload = @version.fetch(
294
+ 'GET',
295
+ @uri,
296
+ params,
297
+ )
298
+
299
+ return HostedNumberOrderInstance.new(
300
+ @version,
301
+ payload,
302
+ sid: @solution[:sid],
303
+ )
304
+ end
305
+
306
+ ##
307
+ # Deletes the HostedNumberOrderInstance
308
+ # @return [Boolean] true if delete succeeds, true otherwise
309
+ def delete
310
+ return @version.delete('delete', @uri)
311
+ end
312
+
313
+ ##
314
+ # Update the HostedNumberOrderInstance
315
+ # @param [String] friendly_name A human readable description of this resource, up
316
+ # to 64 characters.
317
+ # @param [String] unique_name Provides a unique and addressable name to be
318
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
319
+ # used in addition to SID.
320
+ # @param [String] email Email of the owner of this phone number that is being
321
+ # hosted.
322
+ # @param [String] cc_emails Optional. A list of emails that LOA document for this
323
+ # HostedNumberOrder will be carbon copied to.
324
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
325
+ # User can only update this to `pending-loa`.
326
+ # @return [HostedNumberOrderInstance] Updated HostedNumberOrderInstance
327
+ def update(friendly_name: nil, unique_name: nil, email: nil, cc_emails: nil, status: nil)
328
+ data = {
329
+ 'FriendlyName' => friendly_name,
330
+ 'UniqueName' => unique_name,
331
+ 'Email' => email,
332
+ 'CcEmails' => cc_emails,
333
+ 'Status' => status,
334
+ }
335
+
336
+ payload = @version.update(
337
+ 'POST',
338
+ @uri,
339
+ data: data,
340
+ )
341
+
342
+ return HostedNumberOrderInstance.new(
343
+ @version,
344
+ payload,
345
+ sid: @solution[:sid],
346
+ )
347
+ end
348
+
349
+ ##
350
+ # Provide a user friendly representation
351
+ def to_s
352
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
353
+ "#<Twilio.Preview.HostedNumbers.HostedNumberOrderContext #{context}>"
354
+ end
355
+ end
356
+
357
+ class HostedNumberOrderInstance < InstanceResource
358
+ ##
359
+ # Initialize the HostedNumberOrderInstance
360
+ # @param [Version] version Version that contains the resource
361
+ # @param [Hash] payload payload that contains response from Twilio
362
+ # @param [String] sid A 34 character string that uniquely identifies this
363
+ # HostedNumberOrder.
364
+ # @return [HostedNumberOrderInstance] HostedNumberOrderInstance
365
+ def initialize(version, payload, sid: nil)
366
+ super(version)
367
+
368
+ # Marshaled Properties
369
+ @properties = {
370
+ 'sid' => payload['sid'],
371
+ 'account_sid' => payload['account_sid'],
372
+ 'incoming_phone_number_sid' => payload['incoming_phone_number_sid'],
373
+ 'address_sid' => payload['address_sid'],
374
+ 'signing_document_sid' => payload['signing_document_sid'],
375
+ 'phone_number' => payload['phone_number'],
376
+ 'capabilities' => payload['capabilities'],
377
+ 'friendly_name' => payload['friendly_name'],
378
+ 'unique_name' => payload['unique_name'],
379
+ 'status' => payload['status'],
380
+ 'date_created' => Twilio.deserialize_iso8601(payload['date_created']),
381
+ 'date_updated' => Twilio.deserialize_iso8601(payload['date_updated']),
382
+ 'email' => payload['email'],
383
+ 'cc_emails' => payload['cc_emails'],
384
+ 'url' => payload['url'],
385
+ }
386
+
387
+ # Context
388
+ @instance_context = nil
389
+ @params = {
390
+ 'sid' => sid || @properties['sid'],
391
+ }
392
+ end
393
+
394
+ ##
395
+ # Generate an instance context for the instance, the context is capable of
396
+ # performing various actions. All instance actions are proxied to the context
397
+ # @param [Version] version Version that contains the resource
398
+ # @return [HostedNumberOrderContext] HostedNumberOrderContext for this HostedNumberOrderInstance
399
+ def context
400
+ unless @instance_context
401
+ @instance_context = HostedNumberOrderContext.new(
402
+ @version,
403
+ @params['sid'],
404
+ )
405
+ end
406
+ @instance_context
407
+ end
408
+
409
+ def sid
410
+ @properties['sid']
411
+ end
412
+
413
+ def account_sid
414
+ @properties['account_sid']
415
+ end
416
+
417
+ def incoming_phone_number_sid
418
+ @properties['incoming_phone_number_sid']
419
+ end
420
+
421
+ def address_sid
422
+ @properties['address_sid']
423
+ end
424
+
425
+ def signing_document_sid
426
+ @properties['signing_document_sid']
427
+ end
428
+
429
+ def phone_number
430
+ @properties['phone_number']
431
+ end
432
+
433
+ def capabilities
434
+ @properties['capabilities']
435
+ end
436
+
437
+ def friendly_name
438
+ @properties['friendly_name']
439
+ end
440
+
441
+ def unique_name
442
+ @properties['unique_name']
443
+ end
444
+
445
+ def status
446
+ @properties['status']
447
+ end
448
+
449
+ def date_created
450
+ @properties['date_created']
451
+ end
452
+
453
+ def date_updated
454
+ @properties['date_updated']
455
+ end
456
+
457
+ def email
458
+ @properties['email']
459
+ end
460
+
461
+ def cc_emails
462
+ @properties['cc_emails']
463
+ end
464
+
465
+ def url
466
+ @properties['url']
467
+ end
468
+
469
+ ##
470
+ # Fetch a HostedNumberOrderInstance
471
+ # @return [HostedNumberOrderInstance] Fetched HostedNumberOrderInstance
472
+ def fetch
473
+ context.fetch
474
+ end
475
+
476
+ ##
477
+ # Deletes the HostedNumberOrderInstance
478
+ # @return [Boolean] true if delete succeeds, true otherwise
479
+ def delete
480
+ context.delete
481
+ end
482
+
483
+ ##
484
+ # Update the HostedNumberOrderInstance
485
+ # @param [String] friendly_name A human readable description of this resource, up
486
+ # to 64 characters.
487
+ # @param [String] unique_name Provides a unique and addressable name to be
488
+ # assigned to this HostedNumberOrder, assigned by the developer, to be optionally
489
+ # used in addition to SID.
490
+ # @param [String] email Email of the owner of this phone number that is being
491
+ # hosted.
492
+ # @param [String] cc_emails Optional. A list of emails that LOA document for this
493
+ # HostedNumberOrder will be carbon copied to.
494
+ # @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.
495
+ # User can only update this to `pending-loa`.
496
+ # @return [HostedNumberOrderInstance] Updated HostedNumberOrderInstance
497
+ def update(friendly_name: nil, unique_name: nil, email: nil, cc_emails: nil, status: nil)
498
+ context.update(
499
+ friendly_name: friendly_name,
500
+ unique_name: unique_name,
501
+ email: email,
502
+ cc_emails: cc_emails,
503
+ status: status,
504
+ )
505
+ end
506
+
507
+ ##
508
+ # Provide a user friendly representation
509
+ def to_s
510
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
511
+ "<Twilio.Preview.HostedNumbers.HostedNumberOrderInstance #{values}>"
512
+ end
513
+ end
514
+ end
515
+ end
516
+ end
517
+ end