class Twilio::REST::Supersim::V1::SmsCommandList

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 SmsCommandList @param [Version] version Version that contains the resource @return [SmsCommandList] SmsCommandList

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

Public Instance Methods

create(sim: nil, payload: nil, callback_method: :unset, callback_url: :unset) click to toggle source

Create the SmsCommandInstance @param [String] sim The `sid` or `unique_name` of the

{SIM}[https://www.twilio.com/docs/wireless/api/sim-resource] to send the SMS
Command to.

@param [String] payload The message body of the SMS Command. @param [String] callback_method The HTTP method we should use to call

`callback_url`. Can be: `GET` or `POST` and the default is POST.

@param [String] callback_url The URL we should call using the `callback_method`

after we have sent the command.

@return [SmsCommandInstance] Created SmsCommandInstance

   # File lib/twilio-ruby/rest/supersim/v1/sms_command.rb
39 def create(sim: nil, payload: nil, callback_method: :unset, callback_url: :unset)
40   data = Twilio::Values.of({
41       'Sim' => sim,
42       'Payload' => payload,
43       'CallbackMethod' => callback_method,
44       'CallbackUrl' => callback_url,
45   })
46 
47   payload = @version.create('POST', @uri, data: data)
48 
49   SmsCommandInstance.new(@version, payload, )
50 end
each() { |x| ... } click to toggle source

When passed a block, yields SmsCommandInstance 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/sms_command.rb
118 def each
119   limits = @version.read_limits
120 
121   page = self.page(page_size: limits[:page_size], )
122 
123   @version.stream(page,
124                   limit: limits[:limit],
125                   page_limit: limits[:page_limit]).each {|x| yield x}
126 end
get_page(target_url) click to toggle source

Retrieve a single page of SmsCommandInstance records from the API. Request is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page of SmsCommandInstance

    # File lib/twilio-ruby/rest/supersim/v1/sms_command.rb
166 def get_page(target_url)
167   response = @version.domain.request(
168       'GET',
169       target_url
170   )
171   SmsCommandPage.new(@version, response, @solution)
172 end
list(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil) click to toggle source

Lists SmsCommandInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [String] sim The SID or unique name of the Sim resource that SMS Command

was sent to or from.

@param [sms_command.Status] status The status of the SMS Command. Can be:

`queued`, `sent`, `delivered`, `received` or `failed`. See the {SMS Command
Status
Values}[https://www.twilio.com/docs/wireless/api/smscommand-resource#status-values]
for a description of each.

@param [sms_command.Direction] direction The direction of the SMS Command. Can

be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
`mobile terminated`, and `from_sim` is synonymous with the term `mobile
originated`.

@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/sms_command.rb
74 def list(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
75   self.stream(
76       sim: sim,
77       status: status,
78       direction: direction,
79       limit: limit,
80       page_size: page_size
81   ).entries
82 end
page(sim: :unset, status: :unset, direction: :unset, page_token: :unset, page_number: :unset, page_size: :unset) click to toggle source

Retrieve a single page of SmsCommandInstance records from the API. Request is executed immediately. @param [String] sim The SID or unique name of the Sim resource that SMS Command

was sent to or from.

@param [sms_command.Status] status The status of the SMS Command. Can be:

`queued`, `sent`, `delivered`, `received` or `failed`. See the {SMS Command
Status
Values}[https://www.twilio.com/docs/wireless/api/smscommand-resource#status-values]
for a description of each.

@param [sms_command.Direction] direction The direction of the SMS Command. Can

be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
`mobile terminated`, and `from_sim` is synonymous with the term `mobile
originated`.

@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 SmsCommandInstance

    # File lib/twilio-ruby/rest/supersim/v1/sms_command.rb
146 def page(sim: :unset, status: :unset, direction: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
147   params = Twilio::Values.of({
148       'Sim' => sim,
149       'Status' => status,
150       'Direction' => direction,
151       'PageToken' => page_token,
152       'Page' => page_number,
153       'PageSize' => page_size,
154   })
155 
156   response = @version.page('GET', @uri, params: params)
157 
158   SmsCommandPage.new(@version, response, @solution)
159 end
stream(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil) click to toggle source

Streams SmsCommandInstance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [String] sim The SID or unique name of the Sim resource that SMS Command

was sent to or from.

@param [sms_command.Status] status The status of the SMS Command. Can be:

`queued`, `sent`, `delivered`, `received` or `failed`. See the {SMS Command
Status
Values}[https://www.twilio.com/docs/wireless/api/smscommand-resource#status-values]
for a description of each.

@param [sms_command.Direction] direction The direction of the SMS Command. Can

be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term
`mobile terminated`, and `from_sim` is synonymous with the term `mobile
originated`.

@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/sms_command.rb
106 def stream(sim: :unset, status: :unset, direction: :unset, limit: nil, page_size: nil)
107   limits = @version.read_limits(limit, page_size)
108 
109   page = self.page(sim: sim, status: status, direction: direction, page_size: limits[:page_size], )
110 
111   @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
112 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/supersim/v1/sms_command.rb
176 def to_s
177   '#<Twilio.Supersim.V1.SmsCommandList>'
178 end