fluke/devops-service/db/mongo/models/provider_accounts/provider_account.rb
2015-10-22 12:39:22 +03:00

47 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"]
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
}
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