Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, fleet_sid: nil, sid: nil) ⇒ DeviceInstance

Initialize the DeviceInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 292

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  || @properties['fleet_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns Specifies the unique string identifier of the Account responsible for this Device.

Returns:

  • (String)

    Specifies the unique string identifier of the Account responsible for this Device.



365
366
367
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 365

def 
    @properties['account_sid']
end

#contextDeviceContext

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

Returns:



320
321
322
323
324
325
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 320

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

#date_authenticatedTime

Returns Specifies the date this Device was last authenticated, given in UTC ISO 8601 format.

Returns:

  • (Time)

    Specifies the date this Device was last authenticated, given in UTC ISO 8601 format.



395
396
397
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 395

def date_authenticated
    @properties['date_authenticated']
end

#date_createdTime

Returns Specifies the date this Device was created, given in UTC ISO 8601 format.

Returns:

  • (Time)

    Specifies the date this Device was created, given in UTC ISO 8601 format.



383
384
385
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 383

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns Specifies the date this Device was last updated, given in UTC ISO 8601 format.

Returns:

  • (Time)

    Specifies the date this Device was last updated, given in UTC ISO 8601 format.



389
390
391
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 389

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the DeviceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



402
403
404
405
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 402

def delete

    context.delete
end

#deployment_sidString

Returns Specifies the unique string identifier of the Deployment group that this Device is associated with.

Returns:

  • (String)

    Specifies the unique string identifier of the Deployment group that this Device is associated with.



377
378
379
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 377

def deployment_sid
    @properties['deployment_sid']
end

#enabledBoolean

Returns Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false.

Returns:

  • (Boolean)

    Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false.



359
360
361
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 359

def enabled
    @properties['enabled']
end

#fetchDeviceInstance

Fetch the DeviceInstance

Returns:



410
411
412
413
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 410

def fetch

    context.fetch
end

#fleet_sidString

Returns Specifies the unique string identifier of the Fleet that the given Device belongs to.

Returns:

  • (String)

    Specifies the unique string identifier of the Fleet that the given Device belongs to.



353
354
355
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 353

def fleet_sid
    @properties['fleet_sid']
end

#friendly_nameString

Returns Contains a human readable descriptive text for this Device, up to 256 characters long.

Returns:

  • (String)

    Contains a human readable descriptive text for this Device, up to 256 characters long



347
348
349
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 347

def friendly_name
    @properties['friendly_name']
end

#identityString

Returns Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long.

Returns:

  • (String)

    Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long.



371
372
373
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 371

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



446
447
448
449
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 446

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

#sidString

Returns Contains a 34 character string that uniquely identifies this Device resource.

Returns:

  • (String)

    Contains a 34 character string that uniquely identifies this Device resource.



329
330
331
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 329

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



439
440
441
442
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 439

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

#unique_nameString

Returns Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long.

Returns:

  • (String)

    Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long.



341
342
343
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 341

def unique_name
    @properties['unique_name']
end

#update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) ⇒ DeviceInstance

Update the DeviceInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long.

  • identity (String) (defaults to: :unset)

    Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long.

  • deployment_sid (String) (defaults to: :unset)

    Specifies the unique string identifier of the Deployment group that this Device is going to be associated with.

  • enabled (Boolean) (defaults to: :unset)

Returns:



422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 422

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

#urlString

Returns Contains an absolute URL for this Device resource.

Returns:

  • (String)

    Contains an absolute URL for this Device resource.



335
336
337
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 335

def url
    @properties['url']
end