Class: Twilio::REST::Supersim::V1::SimContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/supersim/v1/sim.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ SimContext

Initialize the SimContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Sim resource to fetch.



181
182
183
184
185
186
187
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 181

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {sid: sid, }
  @uri = "/Sims/#{@solution[:sid]}"
end

Instance Method Details

#fetchSimInstance

Fetch the SimInstance

Returns:



192
193
194
195
196
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 192

def fetch
  payload = @version.fetch('GET', @uri)

  SimInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



237
238
239
240
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 237

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Supersim.V1.SimContext #{context}>"
end

#to_sObject

Provide a user friendly representation



230
231
232
233
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 230

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Supersim.V1.SimContext #{context}>"
end

#update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :unset, callback_method: :unset) ⇒ SimInstance

Update the SimInstance

Parameters:

  • unique_name (String) (defaults to: :unset)

    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.

  • status (sim.StatusUpdate) (defaults to: :unset)

    The new status of the resource. Can be: ‘active` or `inactive`. See the [Super SIM Status Values](www.twilio.com/docs/iot/supersim/api/sim-resource#status-values) for more info.

  • fleet (String) (defaults to: :unset)

    The SID or unique name of the Fleet to which the SIM resource should be assigned.

  • callback_url (String) (defaults to: :unset)

    The URL we should call using the ‘callback_method` after an asynchronous update has finished.

  • callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘callback_url`. Can be: `GET` or `POST` and the default is POST.

Returns:



214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 214

def update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :unset, callback_method: :unset)
  data = Twilio::Values.of({
      'UniqueName' => unique_name,
      'Status' => status,
      'Fleet' => fleet,
      'CallbackUrl' => callback_url,
      'CallbackMethod' => callback_method,
  })

  payload = @version.update('POST', @uri, data: data)

  SimInstance.new(@version, payload, sid: @solution[:sid], )
end