Class: Joyent::Keys

Inherits:
Object
  • Object
show all
Defined in:
lib/joyent/keys.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Keys

Returns a new instance of Keys.



3
4
5
# File 'lib/joyent/keys.rb', line 3

def initialize(connection)
  @connection = connection
end

Instance Method Details

#create(name, key) ⇒ Object



15
16
17
# File 'lib/joyent/keys.rb', line 15

def create(name, key)
  Joyent::Key.new(@connection, @connection.execute(:post, "/keys", {:name => name, :key => key}))
end

#get(name) ⇒ Object



11
12
13
# File 'lib/joyent/keys.rb', line 11

def get(name)
  Joyent::Key.new(@connection, @connection.execute(:get, "/keys/#{name}"))
end

#listObject



7
8
9
# File 'lib/joyent/keys.rb', line 7

def list
  @connection.execute(:get, "/keys").map{|attributes| Joyent::Key.new(@connection, attributes)}
end