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

Inherits:
InstanceResource
  • Object
show all
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

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

  • fleet_sid (String) (defaults to: nil)

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

  • sid (String) (defaults to: nil)

    Provides a 34 character string that uniquely identifies the requested Device resource.



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 277

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_sidString

Returns The unique SID that identifies this Account.

Returns:

  • (String)

    The unique SID that identifies this Account.



350
351
352
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 350

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:



305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 305

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

#date_authenticatedTime

Returns The date this Device was authenticated.

Returns:

  • (Time)

    The date this Device was authenticated.



380
381
382
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 380

def date_authenticated
  @properties['date_authenticated']
end

#date_createdTime

Returns The date this Device was created.

Returns:

  • (Time)

    The date this Device was created.



368
369
370
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 368

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Device was updated.

Returns:

  • (Time)

    The date this Device was updated.



374
375
376
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 374

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the DeviceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#deployment_sidString

Returns The unique SID of the Deployment group.

Returns:

  • (String)

    The unique SID of the Deployment group.



362
363
364
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 362

def deployment_sid
  @properties['deployment_sid']
end

#enabledBoolean

Returns Device enabled flag.

Returns:

  • (Boolean)

    Device enabled flag.



344
345
346
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 344

def enabled
  @properties['enabled']
end

#fetchDeviceInstance

Fetch a DeviceInstance

Returns:



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

def fetch
  context.fetch
end

#fleet_sidString

Returns The unique identifier of the Fleet.

Returns:

  • (String)

    The unique identifier of the Fleet.



338
339
340
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 338

def fleet_sid
  @properties['fleet_sid']
end

#friendly_nameString

Returns A human readable description for this Device.

Returns:

  • (String)

    A human readable description for this Device



332
333
334
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 332

def friendly_name
  @properties['friendly_name']
end

#identityString

Returns An identifier of the Device user.

Returns:

  • (String)

    An identifier of the Device user.



356
357
358
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 356

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 426

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

#sidString

Returns A string that uniquely identifies this Device.

Returns:

  • (String)

    A string that uniquely identifies this Device.



314
315
316
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 314

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



419
420
421
422
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 419

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

#unique_nameString

Returns A unique, addressable name of this Device.

Returns:

  • (String)

    A unique, addressable name of this Device.



326
327
328
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 326

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)

    The enabled

Returns:



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

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 URL of this Device.

Returns:

  • (String)

    URL of this Device.



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

def url
  @properties['url']
end