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)

    The SID of the Command resource to fetch.



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

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

Returns:

  • (String)

    The SID of the Account that created the resource



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

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



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

def command
  @properties['command']
end

#command_modecommand.CommandMode

Returns The mode used to send the SMS message.

Returns:

  • (command.CommandMode)

    The mode used to send the SMS message



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

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:



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

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

#date_createdTime

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

Returns:

  • (Time)

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



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

def date_created
  @properties['date_created']
end

#date_updatedTime

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

Returns:

  • (Time)

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



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the CommandInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



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

def delete
  context.delete
end

#delivery_receipt_requestedBoolean

Returns Whether to request a delivery receipt.

Returns:

  • (Boolean)

    Whether to request a delivery receipt



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

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



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

def direction
  @properties['direction']
end

#fetchCommandInstance

Fetch a CommandInstance

Returns:



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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#sim_sidString

Returns The SID of the Sim resource that the Command was sent to or from.

Returns:

  • (String)

    The SID of the Sim resource that the Command was sent to or from



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

def sim_sid
  @properties['sim_sid']
end

#statuscommand.Status

Returns The status of the Command.

Returns:

  • (command.Status)

    The status of the Command



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

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation



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

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

#transportcommand.Transport

Returns The type of transport used.

Returns:

  • (command.Transport)

    The type of transport used



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

def transport
  @properties['transport']
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource



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

def url
  @properties['url']
end