class Twilio::REST::Numbers::V2::RegulatoryComplianceList::RegulationList

Public Class Methods

new(version) click to toggle source

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

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb
19 def initialize(version)
20   super(version)
21 
22   # Path Solution
23   @solution = {}
24   @uri = "/RegulatoryCompliance/Regulations"
25 end

Public Instance Methods

each() { |x| ... } click to toggle source

When passed a block, yields RegulationInstance 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/regulation.rb
86 def each
87   limits = @version.read_limits
88 
89   page = self.page(page_size: limits[:page_size], )
90 
91   @version.stream(page,
92                   limit: limits[:limit],
93                   page_limit: limits[:page_limit]).each {|x| yield x}
94 end
get_page(target_url) click to toggle source

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

    # File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb
128 def get_page(target_url)
129   response = @version.domain.request(
130       'GET',
131       target_url
132   )
133   RegulationPage.new(@version, response, @solution)
134 end
list(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil) click to toggle source

Lists RegulationInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [regulation.EndUserType] end_user_type The type of End User the

regulation requires - can be `individual` or `business`.

@param [String] iso_country The ISO country code of the phone number's country. @param [String] number_type The type of phone number that the regulatory

requiremnt is restricting.

@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/regulation.rb
43 def list(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
44   self.stream(
45       end_user_type: end_user_type,
46       iso_country: iso_country,
47       number_type: number_type,
48       limit: limit,
49       page_size: page_size
50   ).entries
51 end
page(end_user_type: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of RegulationInstance records from the API. Request is executed immediately. @param [regulation.EndUserType] end_user_type The type of End User the

regulation requires - can be `individual` or `business`.

@param [String] iso_country The ISO country code of the phone number's country. @param [String] number_type The type of phone number that the regulatory

requiremnt is restricting.

@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 RegulationInstance

    # File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb
108 def page(end_user_type: :unset, iso_country: :unset, number_type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
109   params = Twilio::Values.of({
110       'EndUserType' => end_user_type,
111       'IsoCountry' => iso_country,
112       'NumberType' => number_type,
113       'PageToken' => page_token,
114       'Page' => page_number,
115       'PageSize' => page_size,
116   })
117 
118   response = @version.page('GET', @uri, params: params)
119 
120   RegulationPage.new(@version, response, @solution)
121 end
stream(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil) click to toggle source

Streams RegulationInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [regulation.EndUserType] end_user_type The type of End User the

regulation requires - can be `individual` or `business`.

@param [String] iso_country The ISO country code of the phone number's country. @param [String] number_type The type of phone number that the regulatory

requiremnt is restricting.

@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/regulation.rb
69 def stream(end_user_type: :unset, iso_country: :unset, number_type: :unset, limit: nil, page_size: nil)
70   limits = @version.read_limits(limit, page_size)
71 
72   page = self.page(
73       end_user_type: end_user_type,
74       iso_country: iso_country,
75       number_type: number_type,
76       page_size: limits[:page_size],
77   )
78 
79   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
80 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/regulation.rb
138 def to_s
139   '#<Twilio.Numbers.V2.RegulationList>'
140 end