| 
									
										
										
										
											2015-10-22 12:39:22 +03:00
										 |  |  | require "db/mongo/models/mongo_model" | 
					
						
							|  |  |  | require "db/mongo/models/model_with_provider" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Devops | 
					
						
							|  |  |  |   module Model | 
					
						
							|  |  |  |     class ProviderAccount < MongoModel | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       include ModelWithProvider | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       attr_accessor :account_name, :description, :ssh_key, :certificate | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       def initialize a={} | 
					
						
							|  |  |  |         self.account_name = a["account_name"] | 
					
						
							|  |  |  |         self.description = a["description"] | 
					
						
							|  |  |  |         self.ssh_key = a["ssh_key"] | 
					
						
							|  |  |  |         self.provider = a["provider"] | 
					
						
							|  |  |  |         self.certificate = a["certificate"] | 
					
						
							| 
									
										
										
										
											2015-10-26 12:04:01 +03:00
										 |  |  |         self.created_at = a["created_at"] | 
					
						
							| 
									
										
										
										
											2015-10-22 12:39:22 +03:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       def to_list_hash | 
					
						
							|  |  |  |         to_hash | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       def to_hash | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "account_name" => self.account_name, | 
					
						
							|  |  |  |           "description" => self.description, | 
					
						
							|  |  |  |           "ssh_key" => self.ssh_key, | 
					
						
							|  |  |  |           "provider" => self.provider, | 
					
						
							| 
									
										
										
										
											2015-10-26 12:04:01 +03:00
										 |  |  |           "certificate" => self.certificate, | 
					
						
							|  |  |  |           "created_at" => self.created_at | 
					
						
							| 
									
										
										
										
											2015-10-22 12:39:22 +03:00
										 |  |  |         } | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       def to_mongo_hash | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           "_id" => self.account_name, | 
					
						
							|  |  |  |           "description" => self.description, | 
					
						
							|  |  |  |           "ssh_key" => self.ssh_key, | 
					
						
							|  |  |  |           "provider" => self.provider, | 
					
						
							|  |  |  |           "certificate" => self.certificate | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |