Class: Twilio::REST::Wireless::V1::SimInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/wireless/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.



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 345

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        'account_sid' => payload['account_sid'],
        'rate_plan_sid' => payload['rate_plan_sid'],
        'friendly_name' => payload['friendly_name'],
        'iccid' => payload['iccid'],
        'e_id' => payload['e_id'],
        'status' => payload['status'],
        'reset_status' => payload['reset_status'],
        'commands_callback_url' => payload['commands_callback_url'],
        'commands_callback_method' => payload['commands_callback_method'],
        'sms_fallback_method' => payload['sms_fallback_method'],
        'sms_fallback_url' => payload['sms_fallback_url'],
        'sms_method' => payload['sms_method'],
        'sms_url' => payload['sms_url'],
        'voice_fallback_method' => payload['voice_fallback_method'],
        'voice_fallback_url' => payload['voice_fallback_url'],
        'voice_method' => payload['voice_method'],
        'voice_url' => payload['voice_url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'links' => payload['links'],
        'ip_address' => payload['ip_address'],
    }

    # 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) to which the Sim resource belongs.

Returns:



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

def 
    @properties['account_sid']
end

#commands_callback_methodString

Returns The HTTP method we use to call ‘commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`.



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

def commands_callback_method
    @properties['commands_callback_method']
end

#commands_callback_urlString

Returns The URL we call using the ‘commands_callback_method` when the SIM originates a machine-to-machine [Command](www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.

Returns:

  • (String)

    The URL we call using the ‘commands_callback_method` when the SIM originates a machine-to-machine [Command](www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.



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

def commands_callback_url
    @properties['commands_callback_url']
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



385
386
387
388
389
390
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 385

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

#data_sessionsdata_sessions

Access the data_sessions

Returns:



619
620
621
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 619

def data_sessions
    context.data_sessions
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](www.iso.org/iso-8601-date-and-time-format.html) format.

Returns:



508
509
510
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 508

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](www.iso.org/iso-8601-date-and-time-format.html) format.

Returns:



514
515
516
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 514

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the SimInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



539
540
541
542
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 539

def delete

    context.delete
end

#e_idString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



430
431
432
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 430

def e_id
    @properties['e_id']
end

#fetchSimInstance

Fetch the SimInstance

Returns:



547
548
549
550
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 547

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the Sim resource.

Returns:

  • (String)

    The string that you assigned to describe the Sim resource.



418
419
420
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 418

def friendly_name
    @properties['friendly_name']
end

#iccidString

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

Returns:



424
425
426
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 424

def iccid
    @properties['iccid']
end

#inspectObject

Provide a detailed, user friendly representation



639
640
641
642
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 639

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

#ip_addressString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



532
533
534
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 532

def ip_address
    @properties['ip_address']
end

Returns The URLs of related subresources.

Returns:

  • (Hash)

    The URLs of related subresources.



526
527
528
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 526

def links
    @properties['links']
end

#rate_plan_sidString

Returns The SID of the [RatePlan resource](www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource is assigned.

Returns:



412
413
414
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 412

def rate_plan_sid
    @properties['rate_plan_sid']
end

#reset_statusResetStatus

Returns:

  • (ResetStatus)


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

def reset_status
    @properties['reset_status']
end

#sidString

Returns The unique string that we created to identify the Sim resource.

Returns:

  • (String)

    The unique string that we created to identify the Sim resource.



394
395
396
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 394

def sid
    @properties['sid']
end

#sms_fallback_methodString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



460
461
462
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 460

def sms_fallback_method
    @properties['sms_fallback_method']
end

#sms_fallback_urlString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



466
467
468
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 466

def sms_fallback_url
    @properties['sms_fallback_url']
end

#sms_methodString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



472
473
474
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 472

def sms_method
    @properties['sms_method']
end

#sms_urlString

Returns Deprecated.

Returns:

  • (String)

    Deprecated.



478
479
480
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 478

def sms_url
    @properties['sms_url']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



632
633
634
635
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 632

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Wireless.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.



400
401
402
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 400

def unique_name
    @properties['unique_name']
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) ⇒ 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 ‘sid` in the URL path to address the resource.

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

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

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

    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`).

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

    A descriptive string that you create to describe the Sim resource. It does not need to be unique.

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

    The SID or unique name of the [RatePlan resource](www.twilio.com/docs/iot/wireless/api/rateplan-resource) to which the Sim resource should be assigned.

  • status (Status) (defaults to: :unset)
  • commands_callback_method (String) (defaults to: :unset)

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

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

    The URL we should call using the ‘commands_callback_method` when the SIM sends a [Command](www.twilio.com/docs/iot/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body is ignored.

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

    The HTTP method we should use to call ‘sms_fallback_url`. Can be: `GET` or `POST`. Default is `POST`.

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

    The URL we should call using the ‘sms_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `sms_url`.

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

    The HTTP method we should use to call ‘sms_url`. Can be: `GET` or `POST`. Default is `POST`.

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

    The URL we should call using the ‘sms_method` when the SIM-connected device sends an SMS message that is not a [Command](www.twilio.com/docs/iot/wireless/api/command-resource).

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

    Deprecated.

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

    Deprecated.

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

    Deprecated.

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

    Deprecated.

  • reset_status (ResetStatus) (defaults to: :unset)
  • account_sid (String) (defaults to: :unset)

    The SID of the [Account](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](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](www.twilio.com/docs/iot/wireless/api/sim-resource#move-sims-between-subaccounts).

Returns:



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 573

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
)

    context.update(
        unique_name: unique_name, 
        callback_method: callback_method, 
        callback_url: callback_url, 
        friendly_name: friendly_name, 
        rate_plan: rate_plan, 
        status: status, 
        commands_callback_method: commands_callback_method, 
        commands_callback_url: commands_callback_url, 
        sms_fallback_method: sms_fallback_method, 
        sms_fallback_url: sms_fallback_url, 
        sms_method: sms_method, 
        sms_url: sms_url, 
        voice_fallback_method: voice_fallback_method, 
        voice_fallback_url: voice_fallback_url, 
        voice_method: voice_method, 
        voice_url: voice_url, 
        reset_status: reset_status, 
        account_sid: , 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



520
521
522
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 520

def url
    @properties['url']
end

#usage_recordsusage_records

Access the usage_records

Returns:



626
627
628
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 626

def usage_records
    context.usage_records
end

#voice_fallback_methodString

Returns Deprecated. The HTTP method we use to call ‘voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`.

Returns:

  • (String)

    Deprecated. The HTTP method we use to call ‘voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`.



484
485
486
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 484

def voice_fallback_method
    @properties['voice_fallback_method']
end

#voice_fallback_urlString

Returns Deprecated. The URL we call using the ‘voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`.

Returns:

  • (String)

    Deprecated. The URL we call using the ‘voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`.



490
491
492
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 490

def voice_fallback_url
    @properties['voice_fallback_url']
end

#voice_methodString

Returns Deprecated. The HTTP method we use to call ‘voice_url`. Can be: `GET` or `POST`. Default is `POST`.

Returns:

  • (String)

    Deprecated. The HTTP method we use to call ‘voice_url`. Can be: `GET` or `POST`. Default is `POST`.



496
497
498
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 496

def voice_method
    @properties['voice_method']
end

#voice_urlString

Returns Deprecated. The URL we call using the ‘voice_method` when the SIM-connected device makes a voice call.

Returns:

  • (String)

    Deprecated. The URL we call using the ‘voice_method` when the SIM-connected device makes a voice call.



502
503
504
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 502

def voice_url
    @properties['voice_url']
end