class Twilio::REST::Supersim::V1::FleetList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the FleetList
@param [Version] version Version
that contains the resource @return [FleetList] FleetList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/supersim/v1/fleet.rb 20 def initialize(version) 21 super(version) 22 23 # Path Solution 24 @solution = {} 25 @uri = "/Fleets" 26 end
Public Instance Methods
Create the FleetInstance
@param [String] network_access_profile The SID or unique name of the Network
Access Profile that will control which cellular networks the Fleet's SIMs can connect to.
@param [String] unique_name An application-defined string that uniquely
identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource.
@param [Boolean] data_enabled Defines whether SIMs in the Fleet are capable of
using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`.
@param [String] data_limit The total data usage (download and upload combined)
in Megabytes that each Sim resource assigned to the Fleet resource can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000).
@param [Boolean] commands_enabled Defines whether SIMs in the Fleet are capable
of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`.
@param [String] commands_url The URL that will receive a webhook when a Super
SIM in the Fleet is used to send an SMS from your device to the Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
@param [String] commands_method A string representing the HTTP
method to use
when making a request to `commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
@param [Boolean] sms_commands_enabled Defines whether SIMs in the Fleet are
capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`.
@param [String] sms_commands_url The URL that will receive a webhook when a
Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.
@param [String] sms_commands_method A string representing the HTTP
method to use
when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.
@return [FleetInstance] Created FleetInstance
# File lib/twilio-ruby/rest/supersim/v1/fleet.rb 63 def create(network_access_profile: nil, unique_name: :unset, data_enabled: :unset, data_limit: :unset, commands_enabled: :unset, commands_url: :unset, commands_method: :unset, sms_commands_enabled: :unset, sms_commands_url: :unset, sms_commands_method: :unset) 64 data = Twilio::Values.of({ 65 'NetworkAccessProfile' => network_access_profile, 66 'UniqueName' => unique_name, 67 'DataEnabled' => data_enabled, 68 'DataLimit' => data_limit, 69 'CommandsEnabled' => commands_enabled, 70 'CommandsUrl' => commands_url, 71 'CommandsMethod' => commands_method, 72 'SmsCommandsEnabled' => sms_commands_enabled, 73 'SmsCommandsUrl' => sms_commands_url, 74 'SmsCommandsMethod' => sms_commands_method, 75 }) 76 77 payload = @version.create('POST', @uri, data: data) 78 79 FleetInstance.new(@version, payload, ) 80 end
When passed a block, yields FleetInstance
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/fleet.rb 130 def each 131 limits = @version.read_limits 132 133 page = self.page(page_size: limits[:page_size], ) 134 135 @version.stream(page, 136 limit: limits[:limit], 137 page_limit: limits[:page_limit]).each {|x| yield x} 138 end
Retrieve a single page of FleetInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of FleetInstance
# File lib/twilio-ruby/rest/supersim/v1/fleet.rb 168 def get_page(target_url) 169 response = @version.domain.request( 170 'GET', 171 target_url 172 ) 173 FleetPage.new(@version, response, @solution) 174 end
Lists FleetInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] network_access_profile The SID or unique name of the Network
Access Profile that controls which cellular networks the Fleet's SIMs can connect to.
@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/fleet.rb 96 def list(network_access_profile: :unset, limit: nil, page_size: nil) 97 self.stream( 98 network_access_profile: network_access_profile, 99 limit: limit, 100 page_size: page_size 101 ).entries 102 end
Retrieve a single page of FleetInstance
records from the API. Request
is executed immediately. @param [String] network_access_profile The SID or unique name of the Network
Access Profile that controls which cellular networks the Fleet's SIMs can connect to.
@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 FleetInstance
# File lib/twilio-ruby/rest/supersim/v1/fleet.rb 150 def page(network_access_profile: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 151 params = Twilio::Values.of({ 152 'NetworkAccessProfile' => network_access_profile, 153 'PageToken' => page_token, 154 'Page' => page_number, 155 'PageSize' => page_size, 156 }) 157 158 response = @version.page('GET', @uri, params: params) 159 160 FleetPage.new(@version, response, @solution) 161 end
Streams FleetInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] network_access_profile The SID or unique name of the Network
Access Profile that controls which cellular networks the Fleet's SIMs can connect to.
@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/fleet.rb 118 def stream(network_access_profile: :unset, limit: nil, page_size: nil) 119 limits = @version.read_limits(limit, page_size) 120 121 page = self.page(network_access_profile: network_access_profile, page_size: limits[:page_size], ) 122 123 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 124 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/supersim/v1/fleet.rb 178 def to_s 179 '#<Twilio.Supersim.V1.FleetList>' 180 end