Class: Twilio::REST::Preview::DeployedDevices::FleetContext::KeyInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.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) ⇒ KeyInstance

Initialize the KeyInstance



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 247

def initialize(version, payload, fleet_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'url' => payload['url'],
      'friendly_name' => payload['friendly_name'],
      'fleet_sid' => payload['fleet_sid'],
      'account_sid' => payload['account_sid'],
      'device_sid' => payload['device_sid'],
      'secret' => payload['secret'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
  }

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

Instance Method Details

#account_sidString



305
306
307
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 305

def 
  @properties['account_sid']
end

#contextKeyContext

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



272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 272

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

#date_createdTime



323
324
325
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 323

def date_created
  @properties['date_created']
end

#date_updatedTime



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the KeyInstance



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

def delete
  context.delete
end

#device_sidString



311
312
313
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 311

def device_sid
  @properties['device_sid']
end

#fetchKeyInstance

Fetch the KeyInstance



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

def fetch
  context.fetch
end

#fleet_sidString



299
300
301
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 299

def fleet_sid
  @properties['fleet_sid']
end

#friendly_nameString



293
294
295
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 293

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#secretString



317
318
319
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 317

def secret
  @properties['secret']
end

#sidString



281
282
283
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 281

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



360
361
362
363
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 360

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

#update(friendly_name: :unset, device_sid: :unset) ⇒ KeyInstance

Update the KeyInstance



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

def update(friendly_name: :unset, device_sid: :unset)
  context.update(friendly_name: friendly_name, device_sid: device_sid, )
end

#urlString



287
288
289
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 287

def url
  @properties['url']
end