class Twilio::REST::Wireless::V1::SimContext

Public Class Methods

new(version, sid) click to toggle source

Initialize the SimContext @param [Version] version Version that contains the resource @param [String] sid The SID or the `unique_name` of the Sim resource to fetch. @return [SimContext] SimContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
195 def initialize(version, sid)
196   super(version)
197 
198   # Path Solution
199   @solution = {sid: sid, }
200   @uri = "/Sims/#{@solution[:sid]}"
201 
202   # Dependents
203   @usage_records = nil
204   @data_sessions = nil
205 end

Public Instance Methods

data_sessions() click to toggle source

Access the data_sessions @return [DataSessionList] @return [DataSessionContext]

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
322 def data_sessions
323   unless @data_sessions
324     @data_sessions = DataSessionList.new(@version, sim_sid: @solution[:sid], )
325   end
326 
327   @data_sessions
328 end
delete() click to toggle source

Delete the SimInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
302 def delete
303    @version.delete('DELETE', @uri)
304 end
fetch() click to toggle source

Fetch the SimInstance @return [SimInstance] Fetched SimInstance

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
210 def fetch
211   payload = @version.fetch('GET', @uri)
212 
213   SimInstance.new(@version, payload, sid: @solution[:sid], )
214 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
339 def inspect
340   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
341   "#<Twilio.Wireless.V1.SimContext #{context}>"
342 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
332 def to_s
333   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
334   "#<Twilio.Wireless.V1.SimContext #{context}>"
335 end
update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset, reset_status: :unset, account_sid: :unset) click to toggle source

Update the SimInstance @param [String] unique_name An application-defined string that uniquely

identifies the resource. It can be used in place of the `sid` in the URL path to
address the resource.

@param [String] callback_method The HTTP method we should use to call

`callback_url`. Can be: `POST` or `GET`. The default is `POST`.

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

when the SIM has finished updating. When the SIM transitions from `new` to
`ready` or from any status to `deactivated`, we call this URL when the status
changes to an intermediate status (`ready` or `deactivated`) and again when the
status changes to its final status (`active` or `canceled`).

@param [String] friendly_name A descriptive string that you create to describe

the Sim resource. It does not need to be unique.

@param [String] rate_plan The SID or unique name of the {RatePlan

resource}[https://www.twilio.com/docs/wireless/api/rateplan-resource] to which
the Sim resource should be assigned.

@param [sim.Status] status The new status of the Sim resource. Can be: `ready`,

`active`, `suspended`, or `deactivated`.

@param [String] commands_callback_method The HTTP method we should use to call

`commands_callback_url`. Can be: `POST` or `GET`. The default is `POST`.

@param [String] commands_callback_url The URL we should call using the

`commands_callback_method` when the SIM sends a
{Command}[https://www.twilio.com/docs/wireless/api/command-resource]. Your
server should respond with an HTTP status code in the 200 range; any response
body is ignored.

@param [String] sms_fallback_method The HTTP method we should use to call

`sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`.

@param [String] sms_fallback_url The URL we should call using the

`sms_fallback_method` when an error occurs while retrieving or executing the
TwiML requested from `sms_url`.

@param [String] sms_method The HTTP method we should use to call `sms_url`. Can

be: `GET` or `POST`. Default is `POST`.

@param [String] sms_url The URL we should call using the `sms_method` when the

SIM-connected device sends an SMS message that is not a
{Command}[https://www.twilio.com/docs/wireless/api/command-resource].

@param [String] voice_fallback_method The HTTP method we should use to call

`voice_fallback_url`. Can be: `GET` or `POST`.

@param [String] voice_fallback_url The URL we should call using the

`voice_fallback_method` when an error occurs while retrieving or executing the
TwiML requested from `voice_url`.

@param [String] voice_method The HTTP method we should use when we call

`voice_url`. Can be: `GET` or `POST`.

@param [String] voice_url The URL we should call using the `voice_method` when

the SIM-connected device makes a voice call.

@param [sim.ResetStatus] reset_status Initiate a connectivity reset on the SIM.

Set to `resetting` to initiate a connectivity reset on the SIM. No other value
is valid.

@param [String] account_sid The SID of the

{Account}[https://www.twilio.com/docs/iam/api/account] to which the Sim resource
should belong. The Account SID can only be that of the requesting Account or
that of a {Subaccount}[https://www.twilio.com/docs/iam/api/subaccounts] of the
requesting Account. Only valid when the Sim resource's status is `new`. For more
information, see the {Move SIMs between Subaccounts
documentation}[https://www.twilio.com/docs/wireless/api/sim-resource#move-sims-between-subaccounts].

@return [SimInstance] Updated SimInstance

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
272 def update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset, reset_status: :unset, account_sid: :unset)
273   data = Twilio::Values.of({
274       'UniqueName' => unique_name,
275       'CallbackMethod' => callback_method,
276       'CallbackUrl' => callback_url,
277       'FriendlyName' => friendly_name,
278       'RatePlan' => rate_plan,
279       'Status' => status,
280       'CommandsCallbackMethod' => commands_callback_method,
281       'CommandsCallbackUrl' => commands_callback_url,
282       'SmsFallbackMethod' => sms_fallback_method,
283       'SmsFallbackUrl' => sms_fallback_url,
284       'SmsMethod' => sms_method,
285       'SmsUrl' => sms_url,
286       'VoiceFallbackMethod' => voice_fallback_method,
287       'VoiceFallbackUrl' => voice_fallback_url,
288       'VoiceMethod' => voice_method,
289       'VoiceUrl' => voice_url,
290       'ResetStatus' => reset_status,
291       'AccountSid' => account_sid,
292   })
293 
294   payload = @version.update('POST', @uri, data: data)
295 
296   SimInstance.new(@version, payload, sid: @solution[:sid], )
297 end
usage_records() click to toggle source

Access the usage_records @return [UsageRecordList] @return [UsageRecordContext]

    # File lib/twilio-ruby/rest/wireless/v1/sim.rb
310 def usage_records
311   unless @usage_records
312     @usage_records = UsageRecordList.new(@version, sim_sid: @solution[:sid], )
313   end
314 
315   @usage_records
316 end