class Twilio::REST::Preview::HostedNumbers::HostedNumberOrderList

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.

Public Class Methods

new(version) click to toggle source

Initialize the HostedNumberOrderList @param [Version] version Version that contains the resource @return [HostedNumberOrderList] HostedNumberOrderList

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
20 def initialize(version)
21   super(version)
22 
23   # Path Solution
24   @solution = {}
25   @uri = "/HostedNumberOrders"
26 end

Public Instance Methods

create(phone_number: nil, sms_capability: nil, account_sid: :unset, friendly_name: :unset, unique_name: :unset, cc_emails: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, sms_application_sid: :unset, address_sid: :unset, email: :unset, verification_type: :unset, verification_document_sid: :unset) click to toggle source

Create the HostedNumberOrderInstance @param [String] phone_number The number to host in

{+E.164}[https://en.wikipedia.org/wiki/E.164] format

@param [Boolean] sms_capability Used to specify that the SMS capability will be

hosted on Twilio's platform.

@param [String] account_sid This defaults to the AccountSid of the authorization

the user is using. This can be provided to specify a subaccount to add the
HostedNumberOrder to.

@param [String] friendly_name A 64 character string that is a human readable

text that describes this resource.

@param [String] unique_name Optional. Provides a unique and addressable name to

be assigned to this HostedNumberOrder, assigned by the developer, to be
optionally used in addition to SID.

@param [Array] cc_emails Optional. A list of emails that the LOA

document for this HostedNumberOrder will be carbon copied to.

@param [String] sms_url The URL that Twilio should request when somebody sends

an SMS to the phone number. This will be copied onto the IncomingPhoneNumber
resource.

@param [String] sms_method The HTTP method that should be used to request the

SmsUrl. Must be either `GET` or `POST`.  This will be copied onto the
IncomingPhoneNumber resource.

@param [String] sms_fallback_url A URL that Twilio will request if an error

occurs requesting or executing the TwiML defined by SmsUrl. This will be copied
onto the IncomingPhoneNumber resource.

@param [String] sms_fallback_method The HTTP method that should be used to

request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied
onto the IncomingPhoneNumber resource.

@param [String] status_callback_url Optional. The Status Callback URL attached

to the IncomingPhoneNumber resource.

@param [String] status_callback_method Optional. The Status Callback Method

attached to the IncomingPhoneNumber resource.

@param [String] sms_application_sid Optional. The 34 character sid of the

application Twilio should use to handle SMS messages sent to this number. If a
`SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and
use those set on the application.

@param [String] address_sid Optional. A 34 character string that uniquely

identifies the Address resource that represents the address of the owner of this
phone number.

@param [String] email Optional. Email of the owner of this phone number that is

being hosted.

@param [hosted_number_order.VerificationType] verification_type Optional. The

method used for verifying ownership of the number to be hosted. One of
phone-call (default) or phone-bill.

@param [String] verification_document_sid Optional. The unique sid identifier of

the Identity Document that represents the document for verifying ownership of
the number to be hosted. Required when VerificationType is phone-bill.

@return [HostedNumberOrderInstance] Created HostedNumberOrderInstance

    # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
212 def create(phone_number: nil, sms_capability: nil, account_sid: :unset, friendly_name: :unset, unique_name: :unset, cc_emails: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, sms_application_sid: :unset, address_sid: :unset, email: :unset, verification_type: :unset, verification_document_sid: :unset)
213   data = Twilio::Values.of({
214       'PhoneNumber' => phone_number,
215       'SmsCapability' => sms_capability,
216       'AccountSid' => account_sid,
217       'FriendlyName' => friendly_name,
218       'UniqueName' => unique_name,
219       'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
220       'SmsUrl' => sms_url,
221       'SmsMethod' => sms_method,
222       'SmsFallbackUrl' => sms_fallback_url,
223       'SmsFallbackMethod' => sms_fallback_method,
224       'StatusCallbackUrl' => status_callback_url,
225       'StatusCallbackMethod' => status_callback_method,
226       'SmsApplicationSid' => sms_application_sid,
227       'AddressSid' => address_sid,
228       'Email' => email,
229       'VerificationType' => verification_type,
230       'VerificationDocumentSid' => verification_document_sid,
231   })
232 
233   payload = @version.create('POST', @uri, data: data)
234 
235   HostedNumberOrderInstance.new(@version, payload, )
236 end
each() { |x| ... } click to toggle source

When passed a block, yields HostedNumberOrderInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.

    # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
105 def each
106   limits = @version.read_limits
107 
108   page = self.page(page_size: limits[:page_size], )
109 
110   @version.stream(page,
111                   limit: limits[:limit],
112                   page_limit: limits[:page_limit]).each {|x| yield x}
113 end
get_page(target_url) click to toggle source

Retrieve a single page of HostedNumberOrderInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of HostedNumberOrderInstance

    # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
156 def get_page(target_url)
157   response = @version.domain.request(
158       'GET',
159       target_url
160   )
161   HostedNumberOrderPage.new(@version, response, @solution)
162 end
list(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, limit: nil, page_size: nil) click to toggle source

Lists HostedNumberOrderInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.

One of `received`, `pending-verification`, `verified`, `pending-loa`,
`carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.

@param [String] phone_number An E164 formatted phone number hosted by this

HostedNumberOrder.

@param [String] incoming_phone_number_sid A 34 character string that uniquely

identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.

@param [String] friendly_name A human readable description of this resource, up

to 64 characters.

@param [String] unique_name Provides a unique and addressable name to be

assigned to this HostedNumberOrder, assigned by the developer, to be optionally
used in addition to SID.

@param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit.  Default is no limit

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records.  If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Array] Array of up to limit results

   # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
51 def list(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, limit: nil, page_size: nil)
52   self.stream(
53       status: status,
54       phone_number: phone_number,
55       incoming_phone_number_sid: incoming_phone_number_sid,
56       friendly_name: friendly_name,
57       unique_name: unique_name,
58       limit: limit,
59       page_size: page_size
60   ).entries
61 end
page(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of HostedNumberOrderInstance records from the API. Request is executed immediately. @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.

One of `received`, `pending-verification`, `verified`, `pending-loa`,
`carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.

@param [String] phone_number An E164 formatted phone number hosted by this

HostedNumberOrder.

@param [String] incoming_phone_number_sid A 34 character string that uniquely

identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.

@param [String] friendly_name A human readable description of this resource, up

to 64 characters.

@param [String] unique_name Provides a unique and addressable name to be

assigned to this HostedNumberOrder, assigned by the developer, to be optionally
used in addition to SID.

@param [String] page_token PageToken provided by the API @param [Integer] page_number Page Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page of HostedNumberOrderInstance

    # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
134 def page(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
135   params = Twilio::Values.of({
136       'Status' => status,
137       'PhoneNumber' => phone_number,
138       'IncomingPhoneNumberSid' => incoming_phone_number_sid,
139       'FriendlyName' => friendly_name,
140       'UniqueName' => unique_name,
141       'PageToken' => page_token,
142       'Page' => page_number,
143       'PageSize' => page_size,
144   })
145 
146   response = @version.page('GET', @uri, params: params)
147 
148   HostedNumberOrderPage.new(@version, response, @solution)
149 end
stream(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, limit: nil, page_size: nil) click to toggle source

Streams HostedNumberOrderInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [hosted_number_order.Status] status The Status of this HostedNumberOrder.

One of `received`, `pending-verification`, `verified`, `pending-loa`,
`carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.

@param [String] phone_number An E164 formatted phone number hosted by this

HostedNumberOrder.

@param [String] incoming_phone_number_sid A 34 character string that uniquely

identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.

@param [String] friendly_name A human readable description of this resource, up

to 64 characters.

@param [String] unique_name Provides a unique and addressable name to be

assigned to this HostedNumberOrder, assigned by the developer, to be optionally
used in addition to SID.

@param [Integer] limit Upper limit for the number of records to return. stream()

guarantees to never return more than limit. Default is no limit.

@param [Integer] page_size Number of records to fetch per request, when

not set will use the default value of 50 records. If no page_size is defined
but a limit is defined, stream() will attempt to read the limit with the most
efficient page size, i.e. min(limit, 1000)

@return [Enumerable] Enumerable that will yield up to limit results

   # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
86 def stream(status: :unset, phone_number: :unset, incoming_phone_number_sid: :unset, friendly_name: :unset, unique_name: :unset, limit: nil, page_size: nil)
87   limits = @version.read_limits(limit, page_size)
88 
89   page = self.page(
90       status: status,
91       phone_number: phone_number,
92       incoming_phone_number_sid: incoming_phone_number_sid,
93       friendly_name: friendly_name,
94       unique_name: unique_name,
95       page_size: limits[:page_size],
96   )
97 
98   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
99 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb
240 def to_s
241   '#<Twilio.Preview.HostedNumbers.HostedNumberOrderList>'
242 end