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

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this resource.



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 288

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 unique id of the Account that this Command belongs to.

Returns:

  • (String)

    The unique id of the Account that this Command belongs to.



331
332
333
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 331

def 
  @properties['account_sid']
end

#commandString

Returns The message being sent to or from the SIM.

Returns:

  • (String)

    The message being sent to or from the SIM.



343
344
345
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 343

def command
  @properties['command']
end

#command_modecommand.CommandMode

Returns A string representing which mode the SMS was sent or received using.

Returns:

  • (command.CommandMode)

    A string representing which mode the SMS was sent or received using.



349
350
351
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 349

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:



316
317
318
319
320
321
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 316

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

#date_createdTime

Returns The date that this resource was created, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The date that this resource was created, given as GMT in ISO 8601 format.



379
380
381
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 379

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The date that this resource was last updated, given as GMT in ISO 8601 format.



385
386
387
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 385

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the CommandInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#delivery_receipt_requestedBoolean

Returns The delivery_receipt_requested.

Returns:

  • (Boolean)

    The delivery_receipt_requested



361
362
363
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 361

def delivery_receipt_requested
  @properties['delivery_receipt_requested']
end

#directioncommand.Direction

Returns The direction of the Command.

Returns:

  • (command.Direction)

    The direction of the Command.



373
374
375
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 373

def direction
  @properties['direction']
end

#fetchCommandInstance

Fetch a CommandInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



325
326
327
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 325

def sid
  @properties['sid']
end

#sim_sidString

Returns The unique ID of the SIM that this Command was sent to or from.

Returns:

  • (String)

    The unique ID of the SIM that this Command was sent to or from.



337
338
339
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 337

def sim_sid
  @properties['sim_sid']
end

#statuscommand.Status

Returns A string representing the status of the Command.

Returns:

  • (command.Status)

    A string representing the status of the Command.



367
368
369
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 367

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#transportcommand.Transport

Returns The transport.

Returns:

  • (command.Transport)

    The transport



355
356
357
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 355

def transport
  @properties['transport']
end

#urlString

Returns The URL for this resource.

Returns:

  • (String)

    The URL for this resource.



391
392
393
# File 'lib/twilio-ruby/rest/wireless/v1/command.rb', line 391

def url
  @properties['url']
end