fluke/devops-service/db/mongo/connectors/stack.rb
2015-03-06 12:20:30 +03:00

25 lines
530 B
Ruby

module Connectors
class Stack < Base
include Helpers::InsertCommand,
Helpers::ShowCommand,
Helpers::ListCommand,
Helpers::DeleteCommand
def initialize(db)
self.collection = db.collection('stacks')
end
def stacks(provider=nil)
query = (provider.nil? ? {} : {'provider' => provider})
list(query)
end
private
def model_from_bson(bson)
provider = bson['provider']
Devops::Model::StackFactory.get_class(provider).build_from_bson(bson)
end
end
end