Class: Twilio::REST::Microvisor::V1::DeviceContext::DeviceSecretInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, device_sid: nil, key: nil) ⇒ DeviceSecretInstance

Initialize the DeviceSecretInstance



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 271

def initialize(version, payload , device_sid: nil, key: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'device_sid' => payload['device_sid'],
        'key' => payload['key'],
        'date_rotated' => Twilio.deserialize_iso8601_datetime(payload['date_rotated']),
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'device_sid' => device_sid  || @properties['device_sid']  ,'key' => key  || @properties['key']  , }
end

Instance Method Details

#contextDeviceSecretContext

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



291
292
293
294
295
296
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 291

def context
    unless @instance_context
        @instance_context = DeviceSecretContext.new(@version , @params['device_sid'], @params['key'])
    end
    @instance_context
end

#date_rotatedTime



312
313
314
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 312

def date_rotated
    @properties['date_rotated']
end

#deleteBoolean

Delete the DeviceSecretInstance



325
326
327
328
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 325

def delete

    context.delete
end

#device_sidString



300
301
302
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 300

def device_sid
    @properties['device_sid']
end

#fetchDeviceSecretInstance

Fetch the DeviceSecretInstance



333
334
335
336
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 333

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



360
361
362
363
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 360

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

#keyString



306
307
308
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 306

def key
    @properties['key']
end

#to_sObject

Provide a user friendly representation



353
354
355
356
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 353

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

#update(value: nil) ⇒ DeviceSecretInstance

Update the DeviceSecretInstance



342
343
344
345
346
347
348
349
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 342

def update(
    value: nil
)

    context.update(
        value: value, 
    )
end

#urlString



318
319
320
# File 'lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb', line 318

def url
    @properties['url']
end