require "db/mongo/models/image" 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.build_from_bson(bson) end end end