class Twilio::REST::Wireless::V1::RatePlanList
Public Class Methods
Initialize the RatePlanList
@param [Version] version Version
that contains the resource @return [RatePlanList] RatePlanList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/wireless/v1/rate_plan.rb 18 def initialize(version) 19 super(version) 20 21 # Path Solution 22 @solution = {} 23 @uri = "/RatePlans" 24 end
Public Instance Methods
Create the RatePlanInstance
@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 [String] friendly_name A descriptive string that you create to describe
the resource. It does not have to be unique.
@param [Boolean] data_enabled Whether SIMs can use GPRS/3G/4G/LTE data
connectivity.
@param [String] data_limit The total data usage (download and upload combined)
in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB and the default value is `1000`.
@param [String] data_metering The model used to meter data usage. Can be: `payg`
and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available {data metering models}[https://www.twilio.com/docs/wireless/api/rateplan-resource#payg-vs-quota-data-plans].
@param [Boolean] messaging_enabled Whether SIMs can make, send, and receive SMS
using {Commands}[https://www.twilio.com/docs/wireless/api/command-resource].
@param [Boolean] voice_enabled Whether SIMs can make and receive voice calls. @param [Boolean] national_roaming_enabled Whether SIMs can roam on networks
other than the home network (T-Mobile USA) in the United States. See {national roaming}[https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming].
@param [Array] international_roaming The list of services that SIMs
capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can be: `data`, `voice`, and `messaging`.
@param [String] national_roaming_data_limit The total data usage (download and
upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. See {national roaming}[https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming] for more info.
@param [String] international_roaming_data_limit The total data usage (download
and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB.
@return [RatePlanInstance] Created RatePlanInstance
# File lib/twilio-ruby/rest/wireless/v1/rate_plan.rb 144 def create(unique_name: :unset, friendly_name: :unset, data_enabled: :unset, data_limit: :unset, data_metering: :unset, messaging_enabled: :unset, voice_enabled: :unset, national_roaming_enabled: :unset, international_roaming: :unset, national_roaming_data_limit: :unset, international_roaming_data_limit: :unset) 145 data = Twilio::Values.of({ 146 'UniqueName' => unique_name, 147 'FriendlyName' => friendly_name, 148 'DataEnabled' => data_enabled, 149 'DataLimit' => data_limit, 150 'DataMetering' => data_metering, 151 'MessagingEnabled' => messaging_enabled, 152 'VoiceEnabled' => voice_enabled, 153 'NationalRoamingEnabled' => national_roaming_enabled, 154 'InternationalRoaming' => Twilio.serialize_list(international_roaming) { |e| e }, 155 'NationalRoamingDataLimit' => national_roaming_data_limit, 156 'InternationalRoamingDataLimit' => international_roaming_data_limit, 157 }) 158 159 payload = @version.create('POST', @uri, data: data) 160 161 RatePlanInstance.new(@version, payload, ) 162 end
When passed a block, yields RatePlanInstance
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/rate_plan.rb 64 def each 65 limits = @version.read_limits 66 67 page = self.page(page_size: limits[:page_size], ) 68 69 @version.stream(page, 70 limit: limits[:limit], 71 page_limit: limits[:page_limit]).each {|x| yield x} 72 end
Retrieve a single page of RatePlanInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of RatePlanInstance
# File lib/twilio-ruby/rest/wireless/v1/rate_plan.rb 98 def get_page(target_url) 99 response = @version.domain.request( 100 'GET', 101 target_url 102 ) 103 RatePlanPage.new(@version, response, @solution) 104 end
Lists RatePlanInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @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/rate_plan.rb 37 def list(limit: nil, page_size: nil) 38 self.stream(limit: limit, page_size: page_size).entries 39 end
Retrieve a single page of RatePlanInstance
records from the API. Request
is executed immediately. @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 RatePlanInstance
# File lib/twilio-ruby/rest/wireless/v1/rate_plan.rb 81 def page(page_token: :unset, page_number: :unset, page_size: :unset) 82 params = Twilio::Values.of({ 83 'PageToken' => page_token, 84 'Page' => page_number, 85 'PageSize' => page_size, 86 }) 87 88 response = @version.page('GET', @uri, params: params) 89 90 RatePlanPage.new(@version, response, @solution) 91 end
Streams RatePlanInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @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/rate_plan.rb 52 def stream(limit: nil, page_size: nil) 53 limits = @version.read_limits(limit, page_size) 54 55 page = self.page(page_size: limits[:page_size], ) 56 57 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 58 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/wireless/v1/rate_plan.rb 166 def to_s 167 '#<Twilio.Wireless.V1.RatePlanList>' 168 end