Class: Twilio::REST::Wireless::V1::CommandInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the CommandInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 539

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'sim_sid' => payload['sim_sid'],
        'command' => payload['command'],
        'command_mode' => payload['command_mode'],
        'transport' => payload['transport'],
        'delivery_receipt_requested' => payload['delivery_receipt_requested'],
        'status' => payload['status'],
        'direction' => payload['direction'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

    # 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 created the Command resource.

Returns:



583
584
585
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 583

def 
    @properties['account_sid']
end

#commandString

Returns The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64.

Returns:

  • (String)

    The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64.



595
596
597
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 595

def command
    @properties['command']
end

#command_modeCommandMode

Returns:

  • (CommandMode)


601
602
603
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 601

def command_mode
    @properties['command_mode']
end

#contextCommandContext

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

Returns:



568
569
570
571
572
573
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 568

def context
    unless @instance_context
        @instance_context = CommandContext.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](www.iso.org/iso-8601-date-and-time-format.html) format.

Returns:



631
632
633
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 631

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](www.iso.org/iso-8601-date-and-time-format.html) format.

Returns:



637
638
639
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 637

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the CommandInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



650
651
652
653
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 650

def delete

    context.delete
end

#delivery_receipt_requestedBoolean

Returns Whether to request a delivery receipt.

Returns:

  • (Boolean)

    Whether to request a delivery receipt.



613
614
615
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 613

def delivery_receipt_requested
    @properties['delivery_receipt_requested']
end

#directionDirection

Returns:

  • (Direction)


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

def direction
    @properties['direction']
end

#fetchCommandInstance

Fetch the CommandInstance

Returns:



658
659
660
661
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 658

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



672
673
674
675
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 672

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

#sidString

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

Returns:

  • (String)

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



577
578
579
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 577

def sid
    @properties['sid']
end

#sim_sidString

Returns The SID of the [Sim resource](www.twilio.com/docs/iot/wireless/api/sim-resource) that the Command was sent to or from.

Returns:



589
590
591
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 589

def sim_sid
    @properties['sim_sid']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



665
666
667
668
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 665

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

#transportTransport

Returns:

  • (Transport)


607
608
609
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 607

def transport
    @properties['transport']
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



643
644
645
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 643

def url
    @properties['url']
end