2015-02-19 13:26:14 +03:00
|
|
|
require "db/mongo/models/image"
|
|
|
|
|
|
2015-02-12 13:01:05 +03:00
|
|
|
module Connectors
|
|
|
|
|
class Image < Base
|
|
|
|
|
include Helpers::InsertCommand,
|
|
|
|
|
Helpers::ShowCommand,
|
|
|
|
|
Helpers::ListCommand,
|
|
|
|
|
Helpers::DeleteCommand,
|
|
|
|
|
Helpers::UpdateCommand
|
|
|
|
|
|
|
|
|
|
def initialize(db)
|
2015-09-21 15:54:33 +03:00
|
|
|
super(db)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def collection_name
|
|
|
|
|
'images'
|
2015-02-12 13:01:05 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def images(provider=nil)
|
|
|
|
|
query = (provider.nil? ? {} : {'provider' => provider})
|
|
|
|
|
list(query)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def model_from_bson(bson)
|
2015-03-06 12:20:30 +03:00
|
|
|
Devops::Model::Image.build_from_bson(bson)
|
2015-02-12 13:01:05 +03:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|