class Twilio::REST::Supersim::V1::NetworkList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the NetworkList
@param [Version] version Version
that contains the resource @return [NetworkList] NetworkList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/supersim/v1/network.rb 20 def initialize(version) 21 super(version) 22 23 # Path Solution 24 @solution = {} 25 @uri = "/Networks" 26 end
Public Instance Methods
When passed a block, yields NetworkInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/supersim/v1/network.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
Retrieve a single page of NetworkInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of NetworkInstance
# File lib/twilio-ruby/rest/supersim/v1/network.rb 130 def get_page(target_url) 131 response = @version.domain.request( 132 'GET', 133 target_url 134 ) 135 NetworkPage.new(@version, response, @solution) 136 end
Lists NetworkInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] iso_country The {ISO country
code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Network resources to read.
@param [String] mcc The 'mobile country code' of a country. Network resources
with this `mcc` in their `identifiers` will be read.
@param [String] mnc The 'mobile network code' of a mobile operator network.
Network resources with this `mnc` in their `identifiers` will be read.
@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/supersim/v1/network.rb 46 def list(iso_country: :unset, mcc: :unset, mnc: :unset, limit: nil, page_size: nil) 47 self.stream( 48 iso_country: iso_country, 49 mcc: mcc, 50 mnc: mnc, 51 limit: limit, 52 page_size: page_size 53 ).entries 54 end
Retrieve a single page of NetworkInstance
records from the API. Request
is executed immediately. @param [String] iso_country The {ISO country
code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Network resources to read.
@param [String] mcc The 'mobile country code' of a country. Network resources
with this `mcc` in their `identifiers` will be read.
@param [String] mnc The 'mobile network code' of a mobile operator network.
Network resources with this `mnc` in their `identifiers` will be read.
@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 NetworkInstance
# File lib/twilio-ruby/rest/supersim/v1/network.rb 110 def page(iso_country: :unset, mcc: :unset, mnc: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 111 params = Twilio::Values.of({ 112 'IsoCountry' => iso_country, 113 'Mcc' => mcc, 114 'Mnc' => mnc, 115 'PageToken' => page_token, 116 'Page' => page_number, 117 'PageSize' => page_size, 118 }) 119 120 response = @version.page('GET', @uri, params: params) 121 122 NetworkPage.new(@version, response, @solution) 123 end
Streams NetworkInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] iso_country The {ISO country
code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the Network resources to read.
@param [String] mcc The 'mobile country code' of a country. Network resources
with this `mcc` in their `identifiers` will be read.
@param [String] mnc The 'mobile network code' of a mobile operator network.
Network resources with this `mnc` in their `identifiers` will be read.
@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/supersim/v1/network.rb 74 def stream(iso_country: :unset, mcc: :unset, mnc: :unset, limit: nil, page_size: nil) 75 limits = @version.read_limits(limit, page_size) 76 77 page = self.page(iso_country: iso_country, mcc: mcc, mnc: mnc, page_size: limits[:page_size], ) 78 79 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 80 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/supersim/v1/network.rb 140 def to_s 141 '#<Twilio.Supersim.V1.NetworkList>' 142 end