Class: Fog::Compute::Packet::SshKey

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/packet/models/ssh_key.rb

Overview

SshKey

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SshKey

Returns a new instance of SshKey.



18
19
20
# File 'lib/fog/compute/packet/models/ssh_key.rb', line 18

def initialize(attributes = {})
  super
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



16
17
18
# File 'lib/fog/compute/packet/models/ssh_key.rb', line 16

def options
  @options
end

Instance Method Details

#destroyObject



42
43
44
45
46
47
# File 'lib/fog/compute/packet/models/ssh_key.rb', line 42

def destroy
  requires :id

  response = service.delete_ssh_key(id)
  true if response.status == 204
end

#saveObject



22
23
24
25
26
27
28
29
30
# File 'lib/fog/compute/packet/models/ssh_key.rb', line 22

def save
  requires :label, :key

  options = {}
  options[:label] = label
  options[:key] = key
  response = service.create_ssh_key(options)
  merge_attributes(response.body)
end

#updateObject



32
33
34
35
36
37
38
39
40
# File 'lib/fog/compute/packet/models/ssh_key.rb', line 32

def update
  requires :id

  options = {}
  options[:label] = label
  options[:key] = key
  response = service.update_ssh_key(id, options)
  merge_attributes(response.body)
end