class Twilio::REST::Preview::HostedNumbers::AuthorizationDocumentList
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
Initialize the AuthorizationDocumentList
@param [Version] version Version
that contains the resource @return [AuthorizationDocumentList] AuthorizationDocumentList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb 20 def initialize(version) 21 super(version) 22 23 # Path Solution 24 @solution = {} 25 @uri = "/AuthorizationDocuments" 26 end
Public Instance Methods
Create the AuthorizationDocumentInstance
@param [Array] hosted_number_order_sids A list of HostedNumberOrder sids
that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform.
@param [String] address_sid A 34 character string that uniquely identifies the
Address resource that is associated with this AuthorizationDocument.
@param [String] email Email that this AuthorizationDocument will be sent to for
signing.
@param [String] contact_title The title of the person authorized to sign the
Authorization Document for this phone number.
@param [String] contact_phone_number The contact phone number of the person
authorized to sign the Authorization Document.
@param [Array] cc_emails Email recipients who will be informed when an
Authorization Document has been sent and signed.
@return [AuthorizationDocumentInstance] Created AuthorizationDocumentInstance
# File lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb 147 def create(hosted_number_order_sids: nil, address_sid: nil, email: nil, contact_title: nil, contact_phone_number: nil, cc_emails: :unset) 148 data = Twilio::Values.of({ 149 'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e }, 150 'AddressSid' => address_sid, 151 'Email' => email, 152 'ContactTitle' => contact_title, 153 'ContactPhoneNumber' => contact_phone_number, 154 'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e }, 155 }) 156 157 payload = @version.create('POST', @uri, data: data) 158 159 AuthorizationDocumentInstance.new(@version, payload, ) 160 end
When passed a block, yields AuthorizationDocumentInstance
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/authorization_document.rb 80 def each 81 limits = @version.read_limits 82 83 page = self.page(page_size: limits[:page_size], ) 84 85 @version.stream(page, 86 limit: limits[:limit], 87 page_limit: limits[:page_limit]).each {|x| yield x} 88 end
Retrieve a single page of AuthorizationDocumentInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of AuthorizationDocumentInstance
# File lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb 123 def get_page(target_url) 124 response = @version.domain.request( 125 'GET', 126 target_url 127 ) 128 AuthorizationDocumentPage.new(@version, response, @solution) 129 end
Lists AuthorizationDocumentInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] email Email that this AuthorizationDocument will be sent to for
signing.
@param [authorization_document.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.
@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/authorization_document.rb 46 def list(email: :unset, status: :unset, limit: nil, page_size: nil) 47 self.stream(email: email, status: status, limit: limit, page_size: page_size).entries 48 end
Retrieve a single page of AuthorizationDocumentInstance
records from the API. Request
is executed immediately. @param [String] email Email that this AuthorizationDocument will be sent to for
signing.
@param [authorization_document.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.
@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 AuthorizationDocumentInstance
# File lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb 104 def page(email: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 105 params = Twilio::Values.of({ 106 'Email' => email, 107 'Status' => status, 108 'PageToken' => page_token, 109 'Page' => page_number, 110 'PageSize' => page_size, 111 }) 112 113 response = @version.page('GET', @uri, params: params) 114 115 AuthorizationDocumentPage.new(@version, response, @solution) 116 end
Streams AuthorizationDocumentInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] email Email that this AuthorizationDocument will be sent to for
signing.
@param [authorization_document.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.
@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/authorization_document.rb 68 def stream(email: :unset, status: :unset, limit: nil, page_size: nil) 69 limits = @version.read_limits(limit, page_size) 70 71 page = self.page(email: email, status: status, page_size: limits[:page_size], ) 72 73 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 74 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb 164 def to_s 165 '#<Twilio.Preview.HostedNumbers.AuthorizationDocumentList>' 166 end