Class: Twilio::REST::Supersim::V1::SimInstance

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ SimInstance

Initialize the SimInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • sid (String) (defaults to: nil) —

    The SID of the Sim resource to fetch.



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 301

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'unique_name' => payload['unique_name'],
      'account_sid' => payload['account_sid'],
      'iccid' => payload['iccid'],
      'status' => payload['status'],
      'fleet_sid' => payload['fleet_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that the Super SIM belongs to.

Returns:

  • (String) —

    The SID of the Account that the Super SIM belongs to



348
349
350
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 348

def 
  @properties['account_sid']
end

#billing_periods ⇒ billing_periods

Access the billing_periods

Returns:



435
436
437
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 435

def billing_periods
  context.billing_periods
end

#context ⇒ SimContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:

  • (SimContext) —

    SimContext for this SimInstance



327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 327

def context
  unless @instance_context
    @instance_context = SimContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_created ⇒ Time

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time) —

    The ISO 8601 date and time in GMT when the resource was created



372
373
374
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 372

def date_created
  @properties['date_created']
end

#date_updated ⇒ Time

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time) —

    The ISO 8601 date and time in GMT when the resource was last updated



378
379
380
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 378

def date_updated
  @properties['date_updated']
end

#fetch ⇒ SimInstance

Fetch the SimInstance

Returns:



397
398
399
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 397

def fetch
  context.fetch
end

#fleet_sid ⇒ String

Returns The unique ID of the Fleet configured for this SIM.

Returns:

  • (String) —

    The unique ID of the Fleet configured for this SIM



366
367
368
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 366

def fleet_sid
  @properties['fleet_sid']
end

#iccid ⇒ String

Returns The ICCID associated with the SIM.

Returns:

  • (String) —

    The ICCID associated with the SIM



354
355
356
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 354

def iccid
  @properties['iccid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



455
456
457
458
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 455

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Supersim.V1.SimInstance #{values}>"
end

Returns The links.

Returns:

  • (String) —

    The links



390
391
392
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 390

def links
  @properties['links']
end

#sid ⇒ String

Returns The unique string that identifies the resource.

Returns:

  • (String) —

    The unique string that identifies the resource



336
337
338
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 336

def sid
  @properties['sid']
end

#sim_ip_addresses ⇒ sim_ip_addresses

Access the sim_ip_addresses

Returns:



442
443
444
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 442

def sim_ip_addresses
  context.sim_ip_addresses
end

#status ⇒ sim.Status

Returns The status of the Super SIM.

Returns:

  • (sim.Status) —

    The status of the Super SIM



360
361
362
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 360

def status
  @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



448
449
450
451
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 448

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Supersim.V1.SimInstance #{values}>"
end

#unique_name ⇒ String

Returns An application-defined string that uniquely identifies the resource.

Returns:

  • (String) —

    An application-defined string that uniquely identifies the resource



342
343
344
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 342

def unique_name
  @properties['unique_name']
end

#update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :unset, callback_method: :unset, account_sid: :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: ready, active, or inactive. See the Super SIM 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.

  • account_sid (String) (defaults to: :unset) —

    The SID of the Account to which the Sim resource should belong. The Account SID can only be that of the requesting Account or that of a Subaccount of the requesting Account. Only valid when the Sim resource's status is new.

Returns:



421
422
423
424
425
426
427
428
429
430
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 421

def update(unique_name: :unset, status: :unset, fleet: :unset, callback_url: :unset, callback_method: :unset, account_sid: :unset)
  context.update(
      unique_name: unique_name,
      status: status,
      fleet: fleet,
      callback_url: callback_url,
      callback_method: callback_method,
      account_sid: ,
  )
end

#url ⇒ String

Returns The absolute URL of the Sim Resource.

Returns:

  • (String) —

    The absolute URL of the Sim Resource



384
385
386
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 384

def url
  @properties['url']
end