26 lines
552 B
Ruby
26 lines
552 B
Ruby
module Connectors
|
|
class StackTemplate < Base
|
|
include Helpers::InsertCommand,
|
|
Helpers::ShowCommand,
|
|
Helpers::ListCommand,
|
|
Helpers::DeleteCommand
|
|
|
|
def initialize(db)
|
|
self.collection = db.collection('stack_templates')
|
|
end
|
|
|
|
def stack_templates(provider=nil)
|
|
query = (provider.nil? ? {} : {'provider' => provider})
|
|
list(query)
|
|
end
|
|
|
|
private
|
|
|
|
def model_from_bson(bson)
|
|
provider = bson['provider']
|
|
::StackTemplateFactory.get_class(provider).build_from_bson(bson)
|
|
end
|
|
end
|
|
|
|
end
|