26 lines
488 B
Ruby
26 lines
488 B
Ruby
|
|
module Connectors
|
||
|
|
class Image < Base
|
||
|
|
include Helpers::InsertCommand,
|
||
|
|
Helpers::ShowCommand,
|
||
|
|
Helpers::ListCommand,
|
||
|
|
Helpers::DeleteCommand,
|
||
|
|
Helpers::UpdateCommand
|
||
|
|
|
||
|
|
def initialize(db)
|
||
|
|
self.collection = db.collection('images')
|
||
|
|
end
|
||
|
|
|
||
|
|
def images(provider=nil)
|
||
|
|
query = (provider.nil? ? {} : {'provider' => provider})
|
||
|
|
list(query)
|
||
|
|
end
|
||
|
|
|
||
|
|
private
|
||
|
|
|
||
|
|
def model_from_bson(bson)
|
||
|
|
::Image.create_from_bson(bson)
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|