class Twilio::REST::Numbers::V2::RegulatoryComplianceList::BundleList
Public Class Methods
Initialize the BundleList
@param [Version] version Version
that contains the resource @return [BundleList] BundleList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 19 def initialize(version) 20 super(version) 21 22 # Path Solution 23 @solution = {} 24 @uri = "/RegulatoryCompliance/Bundles" 25 end
Public Instance Methods
Create the BundleInstance
@param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] email The email address that will receive updates when the
Bundle resource changes status.
@param [String] status_callback The URL we call to inform your application of
status changes.
@param [String] regulation_sid The unique string of a regulation that is
associated to the Bundle resource.
@param [String] iso_country The ISO country code of the Bundle's phone number
country ownership request.
@param [bundle.EndUserType] end_user_type The type of End User of the Bundle
resource.
@param [String] number_type The type of phone number of the Bundle's ownership
request.
@return [BundleInstance] Created BundleInstance
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 44 def create(friendly_name: nil, email: nil, status_callback: :unset, regulation_sid: :unset, iso_country: :unset, end_user_type: :unset, number_type: :unset) 45 data = Twilio::Values.of({ 46 'FriendlyName' => friendly_name, 47 'Email' => email, 48 'StatusCallback' => status_callback, 49 'RegulationSid' => regulation_sid, 50 'IsoCountry' => iso_country, 51 'EndUserType' => end_user_type, 52 'NumberType' => number_type, 53 }) 54 55 payload = @version.create('POST', @uri, data: data) 56 57 BundleInstance.new(@version, payload, ) 58 end
When passed a block, yields BundleInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 131 def each 132 limits = @version.read_limits 133 134 page = self.page(page_size: limits[:page_size], ) 135 136 @version.stream(page, 137 limit: limits[:limit], 138 page_limit: limits[:page_limit]).each {|x| yield x} 139 end
Retrieve a single page of BundleInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of BundleInstance
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 179 def get_page(target_url) 180 response = @version.domain.request( 181 'GET', 182 target_url 183 ) 184 BundlePage.new(@version, response, @solution) 185 end
Lists BundleInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [bundle.Status] status The verification status of the Bundle resource. @param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] regulation_sid The unique string of a regulation that is
associated to the Bundle resource.
@param [String] iso_country The ISO country code of the Bundle's phone number
country ownership request.
@param [String] number_type The type of phone number of the Bundle's ownership
request.
@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/numbers/v2/regulatory_compliance/bundle.rb 80 def list(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil) 81 self.stream( 82 status: status, 83 friendly_name: friendly_name, 84 regulation_sid: regulation_sid, 85 iso_country: iso_country, 86 number_type: number_type, 87 limit: limit, 88 page_size: page_size 89 ).entries 90 end
Retrieve a single page of BundleInstance
records from the API. Request
is executed immediately. @param [bundle.Status] status The verification status of the Bundle resource. @param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] regulation_sid The unique string of a regulation that is
associated to the Bundle resource.
@param [String] iso_country The ISO country code of the Bundle's phone number
country ownership request.
@param [String] number_type The type of phone number of the Bundle's ownership
request.
@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 BundleInstance
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 157 def page(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 158 params = Twilio::Values.of({ 159 'Status' => status, 160 'FriendlyName' => friendly_name, 161 'RegulationSid' => regulation_sid, 162 'IsoCountry' => iso_country, 163 'NumberType' => number_type, 164 'PageToken' => page_token, 165 'Page' => page_number, 166 'PageSize' => page_size, 167 }) 168 169 response = @version.page('GET', @uri, params: params) 170 171 BundlePage.new(@version, response, @solution) 172 end
Streams BundleInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [bundle.Status] status The verification status of the Bundle resource. @param [String] friendly_name The string that you assigned to describe the
resource.
@param [String] regulation_sid The unique string of a regulation that is
associated to the Bundle resource.
@param [String] iso_country The ISO country code of the Bundle's phone number
country ownership request.
@param [String] number_type The type of phone number of the Bundle's ownership
request.
@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/numbers/v2/regulatory_compliance/bundle.rb 112 def stream(status: :unset, friendly_name: :unset, regulation_sid: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil) 113 limits = @version.read_limits(limit, page_size) 114 115 page = self.page( 116 status: status, 117 friendly_name: friendly_name, 118 regulation_sid: regulation_sid, 119 iso_country: iso_country, 120 number_type: number_type, 121 page_size: limits[:page_size], 122 ) 123 124 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 125 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb 189 def to_s 190 '#<Twilio.Numbers.V2.BundleList>' 191 end