28 lines
		
	
	
		
			533 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			533 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| 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)
 | |
|       Devops::Model::Image.build_from_bson(bson)
 | |
|     end
 | |
|   end
 | |
| 
 | |
| end
 | 
