class Twilio::REST::Wireless::V1::SimList
Public Class Methods
Initialize the SimList
@param [Version] version Version
that contains the resource @return [SimList] SimList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/wireless/v1/sim.rb 18 def initialize(version) 19 super(version) 20 21 # Path Solution 22 @solution = {} 23 @uri = "/Sims" 24 end
Public Instance Methods
When passed a block, yields SimInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/wireless/v1/sim.rb 97 def each 98 limits = @version.read_limits 99 100 page = self.page(page_size: limits[:page_size], ) 101 102 @version.stream(page, 103 limit: limits[:limit], 104 page_limit: limits[:page_limit]).each {|x| yield x} 105 end
Retrieve a single page of SimInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of SimInstance
# File lib/twilio-ruby/rest/wireless/v1/sim.rb 145 def get_page(target_url) 146 response = @version.domain.request( 147 'GET', 148 target_url 149 ) 150 SimPage.new(@version, response, @solution) 151 end
Lists SimInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [sim.Status] status Only return Sim resources with this status. @param [String] iccid Only return Sim resources with this ICCID. This will
return a list with a maximum size of 1
@param [String] rate_plan The SID or unique name of a {RatePlan
resource}[https://www.twilio.com/docs/wireless/api/rateplan-resource]. Only return Sim resources assigned to this RatePlan resource.
@param [String] e_id Deprecated. @param [String] sim_registration_code Only return Sim resources with this
registration code. This will return a list with a maximum size of 1.
@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/wireless/v1/sim.rb 46 def list(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, limit: nil, page_size: nil) 47 self.stream( 48 status: status, 49 iccid: iccid, 50 rate_plan: rate_plan, 51 e_id: e_id, 52 sim_registration_code: sim_registration_code, 53 limit: limit, 54 page_size: page_size 55 ).entries 56 end
Retrieve a single page of SimInstance
records from the API. Request
is executed immediately. @param [sim.Status] status Only return Sim resources with this status. @param [String] iccid Only return Sim resources with this ICCID. This will
return a list with a maximum size of 1
@param [String] rate_plan The SID or unique name of a {RatePlan
resource}[https://www.twilio.com/docs/wireless/api/rateplan-resource]. Only return Sim resources assigned to this RatePlan resource.
@param [String] e_id Deprecated. @param [String] sim_registration_code Only return Sim resources with this
registration code. This will return a list with a maximum size of 1.
@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 SimInstance
# File lib/twilio-ruby/rest/wireless/v1/sim.rb 123 def page(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 124 params = Twilio::Values.of({ 125 'Status' => status, 126 'Iccid' => iccid, 127 'RatePlan' => rate_plan, 128 'EId' => e_id, 129 'SimRegistrationCode' => sim_registration_code, 130 'PageToken' => page_token, 131 'Page' => page_number, 132 'PageSize' => page_size, 133 }) 134 135 response = @version.page('GET', @uri, params: params) 136 137 SimPage.new(@version, response, @solution) 138 end
Streams SimInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [sim.Status] status Only return Sim resources with this status. @param [String] iccid Only return Sim resources with this ICCID. This will
return a list with a maximum size of 1
@param [String] rate_plan The SID or unique name of a {RatePlan
resource}[https://www.twilio.com/docs/wireless/api/rateplan-resource]. Only return Sim resources assigned to this RatePlan resource.
@param [String] e_id Deprecated. @param [String] sim_registration_code Only return Sim resources with this
registration code. This will return a list with a maximum size of 1.
@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/wireless/v1/sim.rb 78 def stream(status: :unset, iccid: :unset, rate_plan: :unset, e_id: :unset, sim_registration_code: :unset, limit: nil, page_size: nil) 79 limits = @version.read_limits(limit, page_size) 80 81 page = self.page( 82 status: status, 83 iccid: iccid, 84 rate_plan: rate_plan, 85 e_id: e_id, 86 sim_registration_code: sim_registration_code, 87 page_size: limits[:page_size], 88 ) 89 90 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 91 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/wireless/v1/sim.rb 155 def to_s 156 '#<Twilio.Wireless.V1.SimList>' 157 end