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.



639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 639

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_sid ⇒ String

Returns The SID of the Account to which the Sim resource belongs.

Returns:

  • (String) —

    The SID of the Account to which the Sim resource belongs.



701
702
703
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 701

def 
    @properties['account_sid']
end

#commands_callback_method ⇒ String

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.



749
750
751
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 749

def commands_callback_method
    @properties['commands_callback_method']
end

#commands_callback_url ⇒ String

Returns The URL we call using the commands_callback_method when the SIM originates a machine-to-machine Command. 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. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.



743
744
745
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 743

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

    CallContext for this CallInstance



680
681
682
683
684
685
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 680

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

#data_sessions ⇒ data_sessions

Access the data_sessions

Returns:



914
915
916
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 914

def data_sessions
    context.data_sessions
end

#date_created ⇒ Time

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

Returns:

  • (Time) —

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



803
804
805
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 803

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

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

Returns:

  • (Time) —

    The date and time in GMT when the Sim resource was last updated specified in ISO 8601 format.



809
810
811
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 809

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the SimInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



834
835
836
837
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 834

def delete

    context.delete
end

#e_id ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



725
726
727
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 725

def e_id
    @properties['e_id']
end

#fetch ⇒ SimInstance

Fetch the SimInstance

Returns:



842
843
844
845
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 842

def fetch

    context.fetch
end

#friendly_name ⇒ String

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

Returns:

  • (String) —

    The string that you assigned to describe the Sim resource.



713
714
715
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 713

def friendly_name
    @properties['friendly_name']
end

#iccid ⇒ String

Returns The ICCID associated with the SIM.

Returns:

  • (String) —

    The ICCID associated with the SIM.



719
720
721
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 719

def iccid
    @properties['iccid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



934
935
936
937
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 934

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

#ip_address ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



827
828
829
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 827

def ip_address
    @properties['ip_address']
end

Returns The URLs of related subresources.

Returns:

  • (Hash) —

    The URLs of related subresources.



821
822
823
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 821

def links
    @properties['links']
end

#rate_plan_sid ⇒ String

Returns The SID of the RatePlan resource to which the Sim resource is assigned.

Returns:

  • (String) —

    The SID of the RatePlan resource to which the Sim resource is assigned.



707
708
709
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 707

def rate_plan_sid
    @properties['rate_plan_sid']
end

#reset_status ⇒ ResetStatus

Returns:

  • (ResetStatus)


737
738
739
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 737

def reset_status
    @properties['reset_status']
end

#sid ⇒ String

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.



689
690
691
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 689

def sid
    @properties['sid']
end

#sms_fallback_method ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



755
756
757
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 755

def sms_fallback_method
    @properties['sms_fallback_method']
end

#sms_fallback_url ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



761
762
763
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 761

def sms_fallback_url
    @properties['sms_fallback_url']
end

#sms_method ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



767
768
769
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 767

def sms_method
    @properties['sms_method']
end

#sms_url ⇒ String

Returns Deprecated.

Returns:

  • (String) —

    Deprecated.



773
774
775
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 773

def sms_url
    @properties['sms_url']
end

#status ⇒ Status

Returns:

  • (Status)


731
732
733
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 731

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



927
928
929
930
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 927

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

#unique_name ⇒ String

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.



695
696
697
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 695

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

  • 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 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. For more information, see the Move SIMs between Subaccounts documentation.

Returns:



868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 868

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

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource.



815
816
817
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 815

def url
    @properties['url']
end

#usage_records ⇒ usage_records

Access the usage_records

Returns:



921
922
923
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 921

def usage_records
    context.usage_records
end

#voice_fallback_method ⇒ String

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.



779
780
781
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 779

def voice_fallback_method
    @properties['voice_fallback_method']
end

#voice_fallback_url ⇒ String

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.



785
786
787
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 785

def voice_fallback_url
    @properties['voice_fallback_url']
end

#voice_method ⇒ String

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.



791
792
793
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 791

def voice_method
    @properties['voice_method']
end

#voice_url ⇒ String

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.



797
798
799
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 797

def voice_url
    @properties['voice_url']
end