class Twilio::REST::Supersim::V1::SimList

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version) click to toggle source

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

Calls superclass method Twilio::REST::ListResource::new
   # File lib/twilio-ruby/rest/supersim/v1/sim.rb
20 def initialize(version)
21   super(version)
22 
23   # Path Solution
24   @solution = {}
25   @uri = "/Sims"
26 end

Public Instance Methods

create(iccid: nil, registration_code: nil) click to toggle source

Create the SimInstance @param [String] iccid The

{ICCID}[https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID] of the
Super SIM to be added to your Account.

@param [String] registration_code The 10-digit code required to claim the Super

SIM for your Account.

@return [SimInstance] Created SimInstance

   # File lib/twilio-ruby/rest/supersim/v1/sim.rb
36 def create(iccid: nil, registration_code: nil)
37   data = Twilio::Values.of({'Iccid' => iccid, 'RegistrationCode' => registration_code, })
38 
39   payload = @version.create('POST', @uri, data: data)
40 
41   SimInstance.new(@version, payload, )
42 end
each() { |x| ... } click to toggle source

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/supersim/v1/sim.rb
 98 def each
 99   limits = @version.read_limits
100 
101   page = self.page(page_size: limits[:page_size], )
102 
103   @version.stream(page,
104                   limit: limits[:limit],
105                   page_limit: limits[:page_limit]).each {|x| yield x}
106 end
get_page(target_url) click to toggle source

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/supersim/v1/sim.rb
143 def get_page(target_url)
144   response = @version.domain.request(
145       'GET',
146       target_url
147   )
148   SimPage.new(@version, response, @solution)
149 end
list(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil) click to toggle source

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 The status of the Sim resources to read. Can be

`new`, `ready`, `active`, `inactive`, or `scheduled`.

@param [String] fleet The SID or unique name of the Fleet to which a list of

Sims are assigned.

@param [String] iccid The

{ICCID}[https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID]
associated with a Super SIM to filter the list by. Passing this parameter will
always return a list containing zero or one SIMs.

@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/sim.rb
63 def list(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil)
64   self.stream(status: status, fleet: fleet, iccid: iccid, limit: limit, page_size: page_size).entries
65 end
page(status: :unset, fleet: :unset, iccid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of SimInstance records from the API. Request is executed immediately. @param [sim.Status] status The status of the Sim resources to read. Can be

`new`, `ready`, `active`, `inactive`, or `scheduled`.

@param [String] fleet The SID or unique name of the Fleet to which a list of

Sims are assigned.

@param [String] iccid The

{ICCID}[https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID]
associated with a Super SIM to filter the list by. Passing this parameter will
always return a list containing zero or one SIMs.

@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/supersim/v1/sim.rb
123 def page(status: :unset, fleet: :unset, iccid: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
124   params = Twilio::Values.of({
125       'Status' => status,
126       'Fleet' => fleet,
127       'Iccid' => iccid,
128       'PageToken' => page_token,
129       'Page' => page_number,
130       'PageSize' => page_size,
131   })
132 
133   response = @version.page('GET', @uri, params: params)
134 
135   SimPage.new(@version, response, @solution)
136 end
stream(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil) click to toggle source

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 The status of the Sim resources to read. Can be

`new`, `ready`, `active`, `inactive`, or `scheduled`.

@param [String] fleet The SID or unique name of the Fleet to which a list of

Sims are assigned.

@param [String] iccid The

{ICCID}[https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID]
associated with a Super SIM to filter the list by. Passing this parameter will
always return a list containing zero or one SIMs.

@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/sim.rb
86 def stream(status: :unset, fleet: :unset, iccid: :unset, limit: nil, page_size: nil)
87   limits = @version.read_limits(limit, page_size)
88 
89   page = self.page(status: status, fleet: fleet, iccid: iccid, page_size: limits[:page_size], )
90 
91   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
92 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/supersim/v1/sim.rb
153 def to_s
154   '#<Twilio.Supersim.V1.SimList>'
155 end