Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceInstance
- Defined in:
- lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique SID that identifies this Account.
-
#context ⇒ DeviceContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_authenticated ⇒ Time
The date this Device was authenticated.
-
#date_created ⇒ Time
The date this Device was created.
-
#date_updated ⇒ Time
The date this Device was updated.
-
#delete ⇒ Boolean
Deletes the DeviceInstance.
-
#deployment_sid ⇒ String
The unique SID of the Deployment group.
-
#enabled ⇒ Boolean
Device enabled flag.
-
#fetch ⇒ DeviceInstance
Fetch a DeviceInstance.
-
#fleet_sid ⇒ String
The unique identifier of the Fleet.
-
#friendly_name ⇒ String
A human readable description for this Device.
-
#identity ⇒ String
An identifier of the Device user.
-
#initialize(version, payload, fleet_sid: nil, sid: nil) ⇒ DeviceInstance
constructor
Initialize the DeviceInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#sid ⇒ String
A string that uniquely identifies this Device.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unique_name ⇒ String
A unique, addressable name of this Device.
-
#update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) ⇒ DeviceInstance
Update the DeviceInstance.
-
#url ⇒ String
URL of this Device.
Constructor Details
#initialize(version, payload, fleet_sid: nil, sid: nil) ⇒ DeviceInstance
Initialize the DeviceInstance
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 307 def initialize(version, payload, fleet_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'url' => payload['url'], 'unique_name' => payload['unique_name'], 'friendly_name' => payload['friendly_name'], 'fleet_sid' => payload['fleet_sid'], 'enabled' => payload['enabled'], 'account_sid' => payload['account_sid'], 'identity' => payload['identity'], 'deployment_sid' => payload['deployment_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'date_authenticated' => Twilio.deserialize_iso8601_datetime(payload['date_authenticated']), } # Context @instance_context = nil @params = { 'fleet_sid' => fleet_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique SID that identifies this Account.
387 388 389 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 387 def account_sid @properties['account_sid'] end |
#context ⇒ DeviceContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
338 339 340 341 342 343 344 345 346 347 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 338 def context unless @instance_context @instance_context = DeviceContext.new( @version, @params['fleet_sid'], @params['sid'], ) end @instance_context end |
#date_authenticated ⇒ Time
Returns The date this Device was authenticated.
417 418 419 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 417 def date_authenticated @properties['date_authenticated'] end |
#date_created ⇒ Time
Returns The date this Device was created.
405 406 407 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 405 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date this Device was updated.
411 412 413 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 411 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the DeviceInstance
431 432 433 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 431 def delete context.delete end |
#deployment_sid ⇒ String
Returns The unique SID of the Deployment group.
399 400 401 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 399 def deployment_sid @properties['deployment_sid'] end |
#enabled ⇒ Boolean
Returns Device enabled flag.
381 382 383 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 381 def enabled @properties['enabled'] end |
#fetch ⇒ DeviceInstance
Fetch a DeviceInstance
424 425 426 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 424 def fetch context.fetch end |
#fleet_sid ⇒ String
Returns The unique identifier of the Fleet.
375 376 377 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 375 def fleet_sid @properties['fleet_sid'] end |
#friendly_name ⇒ String
Returns A human readable description for this Device.
369 370 371 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 369 def friendly_name @properties['friendly_name'] end |
#identity ⇒ String
Returns An identifier of the Device user.
393 394 395 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 393 def identity @properties['identity'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
463 464 465 466 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 463 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Preview.DeployedDevices.DeviceInstance #{values}>" end |
#sid ⇒ String
Returns A string that uniquely identifies this Device.
351 352 353 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 351 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
456 457 458 459 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 456 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Preview.DeployedDevices.DeviceInstance #{values}>" end |
#unique_name ⇒ String
Returns A unique, addressable name of this Device.
363 364 365 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 363 def unique_name @properties['unique_name'] end |
#update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) ⇒ DeviceInstance
Update the DeviceInstance
445 446 447 448 449 450 451 452 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 445 def update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) context.update( friendly_name: friendly_name, identity: identity, deployment_sid: deployment_sid, enabled: enabled, ) end |
#url ⇒ String
Returns URL of this Device.
357 358 359 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 357 def url @properties['url'] end |