2015-02-12 13:01:05 +03:00
|
|
|
module Connectors
|
|
|
|
|
class Key < Base
|
|
|
|
|
include Helpers::InsertCommand,
|
|
|
|
|
Helpers::ShowCommand,
|
|
|
|
|
Helpers::ListCommand,
|
|
|
|
|
Helpers::DeleteCommand
|
|
|
|
|
|
|
|
|
|
def initialize(db)
|
|
|
|
|
self.collection = db.collection('keys')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def key(id, scope=nil)
|
|
|
|
|
options = scope ? {'scope' => scope} : {}
|
|
|
|
|
show(id, options)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def key_delete id
|
2015-07-06 17:00:45 +03:00
|
|
|
delete(id, 'scope' => Devops::Model::Key::USER)
|
2015-02-12 13:01:05 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def model_from_bson(bson)
|
2015-03-06 12:20:30 +03:00
|
|
|
Devops::Model::Key.build_from_bson(bson)
|
2015-02-12 13:01:05 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|