49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| 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"]
 | |
|         self.created_at = a["created_at"]
 | |
|       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,
 | |
|           "certificate" => self.certificate,
 | |
|           "created_at" => self.created_at
 | |
|         }
 | |
|       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
 | 
