Class: Twilio::REST::Preview::Wireless::CommandInstance

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



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 285

def initialize(version, payload , sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'device_sid' => payload['device_sid'],
        'sim_sid' => payload['sim_sid'],
        'command' => payload['command'],
        'command_mode' => payload['command_mode'],
        '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:

  • (String)


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

def 
    @properties['account_sid']
end

#commandString

Returns:

  • (String)


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

def command
    @properties['command']
end

#command_modeString

Returns:

  • (String)


351
352
353
# File 'lib/twilio-ruby/rest/preview/wireless/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:



312
313
314
315
316
317
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 312

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

#date_createdTime

Returns:

  • (Time)


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

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


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

def date_updated
    @properties['date_updated']
end

#device_sidString

Returns:

  • (String)


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

def device_sid
    @properties['device_sid']
end

#directionString

Returns:

  • (String)


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

def direction
    @properties['direction']
end

#fetchCommandInstance

Fetch the CommandInstance

Returns:



388
389
390
391
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 388

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



402
403
404
405
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 402

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

#sidString

Returns:

  • (String)


321
322
323
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 321

def sid
    @properties['sid']
end

#sim_sidString

Returns:

  • (String)


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

def sim_sid
    @properties['sim_sid']
end

#statusString

Returns:

  • (String)


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

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



395
396
397
398
# File 'lib/twilio-ruby/rest/preview/wireless/command.rb', line 395

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

#urlString

Returns:

  • (String)


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

def url
    @properties['url']
end