twilio-ruby 6.4.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,329 @@
1
+ ##
2
+ # This code was generated by
3
+ # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4
+ # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5
+ # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6
+ #
7
+ # Twilio - Messaging
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 Messaging < MessagingBase
19
+ class V1 < Version
20
+ class ServiceContext < InstanceContext
21
+
22
+ class ChannelSenderList < ListResource
23
+ ##
24
+ # Initialize the ChannelSenderList
25
+ # @param [Version] version Version that contains the resource
26
+ # @return [ChannelSenderList] ChannelSenderList
27
+ def initialize(version, messaging_service_sid: nil)
28
+ super(version)
29
+ # Path Solution
30
+ @solution = { messaging_service_sid: messaging_service_sid }
31
+ @uri = "/Services/#{@solution[:messaging_service_sid]}/ChannelSenders"
32
+
33
+ end
34
+
35
+ ##
36
+ # Lists ChannelSenderInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
40
+ # guarantees to never return more than limit. Default is no limit
41
+ # @param [Integer] page_size Number of records to fetch per request, when
42
+ # not set will use the default value of 50 records. If no page_size is defined
43
+ # but a limit is defined, stream() will attempt to read the limit with the most
44
+ # efficient page size, i.e. min(limit, 1000)
45
+ # @return [Array] Array of up to limit results
46
+ def list(limit: nil, page_size: nil)
47
+ self.stream(
48
+ limit: limit,
49
+ page_size: page_size
50
+ ).entries
51
+ end
52
+
53
+ ##
54
+ # Streams Instance records from the API as an Enumerable.
55
+ # This operation lazily loads records as efficiently as possible until the limit
56
+ # is reached.
57
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
58
+ # guarantees to never return more than limit. Default is no limit
59
+ # @param [Integer] page_size Number of records to fetch per request, when
60
+ # not set will use the default value of 50 records. If no page_size is defined
61
+ # but a limit is defined, stream() will attempt to read the limit with the most
62
+ # efficient page size, i.e. min(limit, 1000)
63
+ # @return [Enumerable] Enumerable that will yield up to limit results
64
+ def stream(limit: nil, page_size: nil)
65
+ limits = @version.read_limits(limit, page_size)
66
+
67
+ page = self.page(
68
+ page_size: limits[:page_size], )
69
+
70
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
71
+ end
72
+
73
+ ##
74
+ # When passed a block, yields ChannelSenderInstance records from the API.
75
+ # This operation lazily loads records as efficiently as possible until the limit
76
+ # is reached.
77
+ def each
78
+ limits = @version.read_limits
79
+
80
+ page = self.page(page_size: limits[:page_size], )
81
+
82
+ @version.stream(page,
83
+ limit: limits[:limit],
84
+ page_limit: limits[:page_limit]).each {|x| yield x}
85
+ end
86
+
87
+ ##
88
+ # Retrieve a single page of ChannelSenderInstance records from the API.
89
+ # Request is executed immediately.
90
+ # @param [String] page_token PageToken provided by the API
91
+ # @param [Integer] page_number Page Number, this value is simply for client state
92
+ # @param [Integer] page_size Number of records to return, defaults to 50
93
+ # @return [Page] Page of ChannelSenderInstance
94
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
95
+ params = Twilio::Values.of({
96
+ 'PageToken' => page_token,
97
+ 'Page' => page_number,
98
+ 'PageSize' => page_size,
99
+ })
100
+
101
+ response = @version.page('GET', @uri, params: params)
102
+
103
+ ChannelSenderPage.new(@version, response, @solution)
104
+ end
105
+
106
+ ##
107
+ # Retrieve a single page of ChannelSenderInstance records from the API.
108
+ # Request is executed immediately.
109
+ # @param [String] target_url API-generated URL for the requested results page
110
+ # @return [Page] Page of ChannelSenderInstance
111
+ def get_page(target_url)
112
+ response = @version.domain.request(
113
+ 'GET',
114
+ target_url
115
+ )
116
+ ChannelSenderPage.new(@version, response, @solution)
117
+ end
118
+
119
+
120
+
121
+ # Provide a user friendly representation
122
+ def to_s
123
+ '#<Twilio.Messaging.V1.ChannelSenderList>'
124
+ end
125
+ end
126
+
127
+
128
+ ##
129
+ #PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
130
+ class ChannelSenderContext < InstanceContext
131
+ ##
132
+ # Initialize the ChannelSenderContext
133
+ # @param [Version] version Version that contains the resource
134
+ # @param [String] messaging_service_sid The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
135
+ # @param [String] sid The SID of the ChannelSender resource to fetch.
136
+ # @return [ChannelSenderContext] ChannelSenderContext
137
+ def initialize(version, messaging_service_sid, sid)
138
+ super(version)
139
+
140
+ # Path Solution
141
+ @solution = { messaging_service_sid: messaging_service_sid, sid: sid, }
142
+ @uri = "/Services/#{@solution[:messaging_service_sid]}/ChannelSenders/#{@solution[:sid]}"
143
+
144
+
145
+ end
146
+ ##
147
+ # Fetch the ChannelSenderInstance
148
+ # @return [ChannelSenderInstance] Fetched ChannelSenderInstance
149
+ def fetch
150
+
151
+ payload = @version.fetch('GET', @uri)
152
+ ChannelSenderInstance.new(
153
+ @version,
154
+ payload,
155
+ messaging_service_sid: @solution[:messaging_service_sid],
156
+ sid: @solution[:sid],
157
+ )
158
+ end
159
+
160
+
161
+ ##
162
+ # Provide a user friendly representation
163
+ def to_s
164
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
165
+ "#<Twilio.Messaging.V1.ChannelSenderContext #{context}>"
166
+ end
167
+
168
+ ##
169
+ # Provide a detailed, user friendly representation
170
+ def inspect
171
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
172
+ "#<Twilio.Messaging.V1.ChannelSenderContext #{context}>"
173
+ end
174
+ end
175
+
176
+ class ChannelSenderPage < Page
177
+ ##
178
+ # Initialize the ChannelSenderPage
179
+ # @param [Version] version Version that contains the resource
180
+ # @param [Response] response Response from the API
181
+ # @param [Hash] solution Path solution for the resource
182
+ # @return [ChannelSenderPage] ChannelSenderPage
183
+ def initialize(version, response, solution)
184
+ super(version, response)
185
+
186
+ # Path Solution
187
+ @solution = solution
188
+ end
189
+
190
+ ##
191
+ # Build an instance of ChannelSenderInstance
192
+ # @param [Hash] payload Payload response from the API
193
+ # @return [ChannelSenderInstance] ChannelSenderInstance
194
+ def get_instance(payload)
195
+ ChannelSenderInstance.new(@version, payload, messaging_service_sid: @solution[:messaging_service_sid])
196
+ end
197
+
198
+ ##
199
+ # Provide a user friendly representation
200
+ def to_s
201
+ '<Twilio.Messaging.V1.ChannelSenderPage>'
202
+ end
203
+ end
204
+ class ChannelSenderInstance < InstanceResource
205
+ ##
206
+ # Initialize the ChannelSenderInstance
207
+ # @param [Version] version Version that contains the resource
208
+ # @param [Hash] payload payload that contains response from Twilio
209
+ # @param [String] account_sid The SID of the
210
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this ChannelSender
211
+ # resource.
212
+ # @param [String] sid The SID of the Call resource to fetch.
213
+ # @return [ChannelSenderInstance] ChannelSenderInstance
214
+ def initialize(version, payload , messaging_service_sid: nil, sid: nil)
215
+ super(version)
216
+
217
+ # Marshaled Properties
218
+ @properties = {
219
+ 'account_sid' => payload['account_sid'],
220
+ 'messaging_service_sid' => payload['messaging_service_sid'],
221
+ 'sid' => payload['sid'],
222
+ 'sender' => payload['sender'],
223
+ 'sender_type' => payload['sender_type'],
224
+ 'country_code' => payload['country_code'],
225
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
226
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
227
+ 'url' => payload['url'],
228
+ }
229
+
230
+ # Context
231
+ @instance_context = nil
232
+ @params = { 'messaging_service_sid' => messaging_service_sid || @properties['messaging_service_sid'] ,'sid' => sid || @properties['sid'] , }
233
+ end
234
+
235
+ ##
236
+ # Generate an instance context for the instance, the context is capable of
237
+ # performing various actions. All instance actions are proxied to the context
238
+ # @return [ChannelSenderContext] CallContext for this CallInstance
239
+ def context
240
+ unless @instance_context
241
+ @instance_context = ChannelSenderContext.new(@version , @params['messaging_service_sid'], @params['sid'])
242
+ end
243
+ @instance_context
244
+ end
245
+
246
+ ##
247
+ # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource.
248
+ def account_sid
249
+ @properties['account_sid']
250
+ end
251
+
252
+ ##
253
+ # @return [String] The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with.
254
+ def messaging_service_sid
255
+ @properties['messaging_service_sid']
256
+ end
257
+
258
+ ##
259
+ # @return [String] The unique string that we created to identify the ChannelSender resource.
260
+ def sid
261
+ @properties['sid']
262
+ end
263
+
264
+ ##
265
+ # @return [String] The unique string that identifies the sender e.g whatsapp:+123456XXXX.
266
+ def sender
267
+ @properties['sender']
268
+ end
269
+
270
+ ##
271
+ # @return [String] A string value that identifies the sender type e.g WhatsApp, Messenger.
272
+ def sender_type
273
+ @properties['sender_type']
274
+ end
275
+
276
+ ##
277
+ # @return [String] The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
278
+ def country_code
279
+ @properties['country_code']
280
+ end
281
+
282
+ ##
283
+ # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
284
+ def date_created
285
+ @properties['date_created']
286
+ end
287
+
288
+ ##
289
+ # @return [Time] The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
290
+ def date_updated
291
+ @properties['date_updated']
292
+ end
293
+
294
+ ##
295
+ # @return [String]
296
+ def url
297
+ @properties['url']
298
+ end
299
+
300
+ ##
301
+ # Fetch the ChannelSenderInstance
302
+ # @return [ChannelSenderInstance] Fetched ChannelSenderInstance
303
+ def fetch
304
+
305
+ context.fetch
306
+ end
307
+
308
+ ##
309
+ # Provide a user friendly representation
310
+ def to_s
311
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
312
+ "<Twilio.Messaging.V1.ChannelSenderInstance #{values}>"
313
+ end
314
+
315
+ ##
316
+ # Provide a detailed, user friendly representation
317
+ def inspect
318
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
319
+ "<Twilio.Messaging.V1.ChannelSenderInstance #{values}>"
320
+ end
321
+ end
322
+
323
+ end
324
+ end
325
+ end
326
+ end
327
+ end
328
+
329
+
@@ -41,7 +41,7 @@ module Twilio
41
41
  # @param [Boolean] mms_converter Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance.
42
42
  # @param [Boolean] smart_encoding Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance.
43
43
  # @param [ScanMessageContent] scan_message_content
44
- # @param [Boolean] fallback_to_long_code Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/messaging/services#fallback-to-long-code) for messages sent through the Service instance.
44
+ # @param [Boolean] fallback_to_long_code [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.
45
45
  # @param [Boolean] area_code_geomatch Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance.
46
46
  # @param [String] validity_period How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`.
47
47
  # @param [Boolean] synchronous_validation Reserved.
@@ -208,6 +208,7 @@ module Twilio
208
208
  @us_app_to_person = nil
209
209
  @phone_numbers = nil
210
210
  @alpha_senders = nil
211
+ @channel_senders = nil
211
212
  end
212
213
  ##
213
214
  # Delete the ServiceInstance
@@ -242,7 +243,7 @@ module Twilio
242
243
  # @param [Boolean] mms_converter Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance.
243
244
  # @param [Boolean] smart_encoding Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance.
244
245
  # @param [ScanMessageContent] scan_message_content
245
- # @param [Boolean] fallback_to_long_code Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/messaging/services#fallback-to-long-code) for messages sent through the Service instance.
246
+ # @param [Boolean] fallback_to_long_code [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.
246
247
  # @param [Boolean] area_code_geomatch Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance.
247
248
  # @param [String] validity_period How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`.
248
249
  # @param [Boolean] synchronous_validation Reserved.
@@ -382,6 +383,25 @@ module Twilio
382
383
 
383
384
  @alpha_senders
384
385
  end
386
+ ##
387
+ # Access the channel_senders
388
+ # @return [ChannelSenderList]
389
+ # @return [ChannelSenderContext] if sid was passed.
390
+ def channel_senders(sid=:unset)
391
+
392
+ raise ArgumentError, 'sid cannot be nil' if sid.nil?
393
+
394
+ if sid != :unset
395
+ return ChannelSenderContext.new(@version, @solution[:sid],sid )
396
+ end
397
+
398
+ unless @channel_senders
399
+ @channel_senders = ChannelSenderList.new(
400
+ @version, messaging_service_sid: @solution[:sid], )
401
+ end
402
+
403
+ @channel_senders
404
+ end
385
405
 
386
406
  ##
387
407
  # Provide a user friendly representation
@@ -567,7 +587,7 @@ module Twilio
567
587
  end
568
588
 
569
589
  ##
570
- # @return [Boolean] Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/messaging/services#fallback-to-long-code) for messages sent through the Service instance.
590
+ # @return [Boolean] [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.
571
591
  def fallback_to_long_code
572
592
  @properties['fallback_to_long_code']
573
593
  end
@@ -648,7 +668,7 @@ module Twilio
648
668
  # @param [Boolean] mms_converter Whether to enable the [MMS Converter](https://www.twilio.com/docs/messaging/services#mms-converter) for messages sent through the Service instance.
649
669
  # @param [Boolean] smart_encoding Whether to enable [Smart Encoding](https://www.twilio.com/docs/messaging/services#smart-encoding) for messages sent through the Service instance.
650
670
  # @param [ScanMessageContent] scan_message_content
651
- # @param [Boolean] fallback_to_long_code Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/messaging/services#fallback-to-long-code) for messages sent through the Service instance.
671
+ # @param [Boolean] fallback_to_long_code [OBSOLETE] Former feature used to fallback to long code sender after certain short code message failures.
652
672
  # @param [Boolean] area_code_geomatch Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/messaging/services#area-code-geomatch) on the Service Instance.
653
673
  # @param [String] validity_period How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`.
654
674
  # @param [Boolean] synchronous_validation Reserved.
@@ -729,6 +749,13 @@ module Twilio
729
749
  context.alpha_senders
730
750
  end
731
751
 
752
+ ##
753
+ # Access the channel_senders
754
+ # @return [channel_senders] channel_senders
755
+ def channel_senders
756
+ context.channel_senders
757
+ end
758
+
732
759
  ##
733
760
  # Provide a user friendly representation
734
761
  def to_s
@@ -0,0 +1,249 @@
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 BulkHostedNumberOrderList < ListResource
21
+ ##
22
+ # Initialize the BulkHostedNumberOrderList
23
+ # @param [Version] version Version that contains the resource
24
+ # @return [BulkHostedNumberOrderList] BulkHostedNumberOrderList
25
+ def initialize(version)
26
+ super(version)
27
+ # Path Solution
28
+ @solution = { }
29
+
30
+
31
+ end
32
+
33
+
34
+
35
+ # Provide a user friendly representation
36
+ def to_s
37
+ '#<Twilio.Numbers.V2.BulkHostedNumberOrderList>'
38
+ end
39
+ end
40
+
41
+
42
+ ##
43
+ #PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
44
+ class BulkHostedNumberOrderContext < InstanceContext
45
+ ##
46
+ # Initialize the BulkHostedNumberOrderContext
47
+ # @param [Version] version Version that contains the resource
48
+ # @param [String] bulk_hosting_sid A 34 character string that uniquely identifies this BulkHostedNumberOrder.
49
+ # @return [BulkHostedNumberOrderContext] BulkHostedNumberOrderContext
50
+ def initialize(version, bulk_hosting_sid)
51
+ super(version)
52
+
53
+ # Path Solution
54
+ @solution = { bulk_hosting_sid: bulk_hosting_sid, }
55
+ @uri = "/HostedNumber/Orders/Bulk/#{@solution[:bulk_hosting_sid]}"
56
+
57
+
58
+ end
59
+ ##
60
+ # Fetch the BulkHostedNumberOrderInstance
61
+ # @param [String] order_status Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
62
+ # @return [BulkHostedNumberOrderInstance] Fetched BulkHostedNumberOrderInstance
63
+ def fetch(
64
+ order_status: :unset
65
+ )
66
+
67
+ params = Twilio::Values.of({
68
+ 'OrderStatus' => order_status,
69
+ })
70
+ payload = @version.fetch('GET', @uri, params: params)
71
+ BulkHostedNumberOrderInstance.new(
72
+ @version,
73
+ payload,
74
+ bulk_hosting_sid: @solution[:bulk_hosting_sid],
75
+ )
76
+ end
77
+
78
+
79
+ ##
80
+ # Provide a user friendly representation
81
+ def to_s
82
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
83
+ "#<Twilio.Numbers.V2.BulkHostedNumberOrderContext #{context}>"
84
+ end
85
+
86
+ ##
87
+ # Provide a detailed, user friendly representation
88
+ def inspect
89
+ context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
90
+ "#<Twilio.Numbers.V2.BulkHostedNumberOrderContext #{context}>"
91
+ end
92
+ end
93
+
94
+ class BulkHostedNumberOrderPage < Page
95
+ ##
96
+ # Initialize the BulkHostedNumberOrderPage
97
+ # @param [Version] version Version that contains the resource
98
+ # @param [Response] response Response from the API
99
+ # @param [Hash] solution Path solution for the resource
100
+ # @return [BulkHostedNumberOrderPage] BulkHostedNumberOrderPage
101
+ def initialize(version, response, solution)
102
+ super(version, response)
103
+
104
+ # Path Solution
105
+ @solution = solution
106
+ end
107
+
108
+ ##
109
+ # Build an instance of BulkHostedNumberOrderInstance
110
+ # @param [Hash] payload Payload response from the API
111
+ # @return [BulkHostedNumberOrderInstance] BulkHostedNumberOrderInstance
112
+ def get_instance(payload)
113
+ BulkHostedNumberOrderInstance.new(@version, payload)
114
+ end
115
+
116
+ ##
117
+ # Provide a user friendly representation
118
+ def to_s
119
+ '<Twilio.Numbers.V2.BulkHostedNumberOrderPage>'
120
+ end
121
+ end
122
+ class BulkHostedNumberOrderInstance < InstanceResource
123
+ ##
124
+ # Initialize the BulkHostedNumberOrderInstance
125
+ # @param [Version] version Version that contains the resource
126
+ # @param [Hash] payload payload that contains response from Twilio
127
+ # @param [String] account_sid The SID of the
128
+ # {Account}[https://www.twilio.com/docs/iam/api/account] that created this BulkHostedNumberOrder
129
+ # resource.
130
+ # @param [String] sid The SID of the Call resource to fetch.
131
+ # @return [BulkHostedNumberOrderInstance] BulkHostedNumberOrderInstance
132
+ def initialize(version, payload , bulk_hosting_sid: nil)
133
+ super(version)
134
+
135
+ # Marshaled Properties
136
+ @properties = {
137
+ 'bulk_hosting_sid' => payload['bulk_hosting_sid'],
138
+ 'request_status' => payload['request_status'],
139
+ 'friendly_name' => payload['friendly_name'],
140
+ 'notification_email' => payload['notification_email'],
141
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
142
+ 'date_completed' => Twilio.deserialize_iso8601_datetime(payload['date_completed']),
143
+ 'url' => payload['url'],
144
+ 'total_count' => payload['total_count'] == nil ? payload['total_count'] : payload['total_count'].to_i,
145
+ 'results' => payload['results'],
146
+ }
147
+
148
+ # Context
149
+ @instance_context = nil
150
+ @params = { 'bulk_hosting_sid' => bulk_hosting_sid || @properties['bulk_hosting_sid'] , }
151
+ end
152
+
153
+ ##
154
+ # Generate an instance context for the instance, the context is capable of
155
+ # performing various actions. All instance actions are proxied to the context
156
+ # @return [BulkHostedNumberOrderContext] CallContext for this CallInstance
157
+ def context
158
+ unless @instance_context
159
+ @instance_context = BulkHostedNumberOrderContext.new(@version , @params['bulk_hosting_sid'])
160
+ end
161
+ @instance_context
162
+ end
163
+
164
+ ##
165
+ # @return [String] A 34 character string that uniquely identifies this BulkHostedNumberOrder.
166
+ def bulk_hosting_sid
167
+ @properties['bulk_hosting_sid']
168
+ end
169
+
170
+ ##
171
+ # @return [RequestStatus]
172
+ def request_status
173
+ @properties['request_status']
174
+ end
175
+
176
+ ##
177
+ # @return [String] A 128 character string that is a human-readable text that describes this resource.
178
+ def friendly_name
179
+ @properties['friendly_name']
180
+ end
181
+
182
+ ##
183
+ # @return [String] Email address used for send notifications about this Bulk hosted number request.
184
+ def notification_email
185
+ @properties['notification_email']
186
+ end
187
+
188
+ ##
189
+ # @return [Time] The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
190
+ def date_created
191
+ @properties['date_created']
192
+ end
193
+
194
+ ##
195
+ # @return [Time] The date that this resource was completed, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
196
+ def date_completed
197
+ @properties['date_completed']
198
+ end
199
+
200
+ ##
201
+ # @return [String] The URL of this BulkHostedNumberOrder resource.
202
+ def url
203
+ @properties['url']
204
+ end
205
+
206
+ ##
207
+ # @return [String] The total count of phone numbers in this Bulk hosting request.
208
+ def total_count
209
+ @properties['total_count']
210
+ end
211
+
212
+ ##
213
+ # @return [Array<Hash>] Contains a list of all the individual hosting orders and their information, for this Bulk request. Each result object is grouped by its order status. To see a complete list of order status, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
214
+ def results
215
+ @properties['results']
216
+ end
217
+
218
+ ##
219
+ # Fetch the BulkHostedNumberOrderInstance
220
+ # @param [String] order_status Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
221
+ # @return [BulkHostedNumberOrderInstance] Fetched BulkHostedNumberOrderInstance
222
+ def fetch(
223
+ order_status: :unset
224
+ )
225
+
226
+ context.fetch(
227
+ order_status: order_status,
228
+ )
229
+ end
230
+
231
+ ##
232
+ # Provide a user friendly representation
233
+ def to_s
234
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
235
+ "<Twilio.Numbers.V2.BulkHostedNumberOrderInstance #{values}>"
236
+ end
237
+
238
+ ##
239
+ # Provide a detailed, user friendly representation
240
+ def inspect
241
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
242
+ "<Twilio.Numbers.V2.BulkHostedNumberOrderInstance #{values}>"
243
+ end
244
+ end
245
+
246
+ end
247
+ end
248
+ end
249
+ end