Class: Hcloud::SSHKey

Inherits:
Object
  • Object
show all
Includes:
EntryLoader
Defined in:
lib/hcloud/ssh_key.rb

Constant Summary collapse

Attributes =
{
  id: nil,
  name: nil,
  fingerprint: nil,
  public_key: nil
}

Instance Method Summary collapse

Methods included from EntryLoader

#initialize, #request

Instance Method Details

#destroyObject



18
19
20
21
# File 'lib/hcloud/ssh_key.rb', line 18

def destroy
  request("ssh_keys/#{id}", method: :delete).run.body
  true
end

#update(name:) ⇒ Object



11
12
13
14
15
16
# File 'lib/hcloud/ssh_key.rb', line 11

def update(name:)
  j = Oj.load(request("ssh_keys/#{id.to_i}", 
                      j: {name: name}, 
                      method: :put).run.body)
  SSHKey.new(j["ssh_key"], self, client)
end