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

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

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

  • account_sid (String)

    The SID of the Account that created this Sim resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 309

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_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that the Super SIM belongs to.

Returns:



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

def 
    @properties['account_sid']
end

#billing_periodsbilling_periods

Access the billing_periods

Returns:



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

def billing_periods
    context.billing_periods
end

#contextSimContext

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)

    CallContext for this CallInstance



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

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

def date_updated
    @properties['date_updated']
end

#fetchSimInstance

Fetch the SimInstance

Returns:



405
406
407
408
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 405

def fetch

    context.fetch
end

#fleet_sidString

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

Returns:

  • (String)

    The unique ID of the Fleet configured for this SIM.



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

def fleet_sid
    @properties['fleet_sid']
end

#iccidString

Returns The [ICCID](en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM.

Returns:



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

def iccid
    @properties['iccid']
end

#inspectObject

Provide a detailed, user friendly representation



461
462
463
464
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 461

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

Returns:

  • (Hash)


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

def links
    @properties['links']
end

#sidString

Returns The unique string that identifies the Sim resource.

Returns:

  • (String)

    The unique string that identifies the Sim resource.



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

def sid
    @properties['sid']
end

#sim_ip_addressessim_ip_addresses

Access the sim_ip_addresses

Returns:



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

def sim_ip_addresses
    context.sim_ip_addresses
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString

Returns 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.

Returns:

  • (String)

    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.



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

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 (StatusUpdate) (defaults to: :unset)
  • 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:



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/twilio-ruby/rest/supersim/v1/sim.rb', line 419

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

#urlString

Returns The absolute URL of the Sim Resource.

Returns:

  • (String)

    The absolute URL of the Sim Resource.



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

def url
    @properties['url']
end