Class: Octopi::Key

Inherits:
Base
  • Object
show all
Includes:
Resource
Defined in:
lib/octopi/key.rb

Constant Summary

Constants inherited from Base

Base::VALID

Instance Attribute Summary collapse

Attributes inherited from Base

#api

Instance Method Summary collapse

Methods included from Resource

for, included

Methods inherited from Base

#property, #save

Constructor Details

#initialize(api, data, user = nil) ⇒ Key

Returns a new instance of Key.



7
8
9
10
# File 'lib/octopi/key.rb', line 7

def initialize(api, data, user = nil)
  super api, data
  @user = user
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'lib/octopi/key.rb', line 5

def user
  @user
end

Instance Method Details

#remove!Object



12
13
14
15
16
# File 'lib/octopi/key.rb', line 12

def remove!
  result = @api.post "/user/key/remove", :id => id
  keys = result["public_keys"].select { |k| k["title"] == title }
  keys.empty?
end