| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | module Connectors | 
					
						
							|  |  |  |   class Stack < Base | 
					
						
							|  |  |  |     include Helpers::InsertCommand, | 
					
						
							|  |  |  |       Helpers::ShowCommand, | 
					
						
							|  |  |  |       Helpers::ListCommand, | 
					
						
							| 
									
										
										
										
											2015-07-14 16:51:40 +03:00
										 |  |  |       Helpers::DeleteCommand, | 
					
						
							|  |  |  |       Helpers::UpdateCommand | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def initialize(db) | 
					
						
							|  |  |  |       self.collection = db.collection('stacks') | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def stacks(provider=nil) | 
					
						
							|  |  |  |       query = (provider.nil? ? {} : {'provider' => provider}) | 
					
						
							|  |  |  |       list(query) | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     private | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def model_from_bson(bson) | 
					
						
							|  |  |  |       provider = bson['provider'] | 
					
						
							| 
									
										
										
										
											2015-03-06 12:20:30 +03:00
										 |  |  |       Devops::Model::StackFactory.get_class(provider).build_from_bson(bson) | 
					
						
							| 
									
										
										
										
											2015-02-12 13:01:05 +03:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |