Add epp attr map

This commit is contained in:
Martin Lensment 2014-08-08 10:28:29 +03:00
parent 3256534f0d
commit ec9dcf52cf
4 changed files with 8 additions and 4 deletions

View file

@ -26,7 +26,7 @@ module EppErrors
else
next unless code = find_epp_code(err)
err = {code: code, msg: err}
err[:value] = {val: send(key), obj: self.class::EPP_OBJ} unless self.class.reflect_on_association(key)
err[:value] = {val: send(key), obj: self.class::EPP_ATTR_MAP[key]} unless self.class.reflect_on_association(key)
epp_errors << err
end
end

View file

@ -10,7 +10,7 @@ class Contact < ActiveRecord::Base
'2005' => ['Phone nr is invalid', 'Email is invalid']
}
EPP_OBJ = 'contact'
EPP_ATTR_MAP = {}
has_one :address
has_many :domain_contacts

View file

@ -11,7 +11,9 @@ class Domain < ActiveRecord::Base
'2303' => ['Contact was not found'] # Object does not exist
}
EPP_OBJ = 'domain'
EPP_ATTR_MAP = {
owner_contact: 'registrant'
}
belongs_to :registrar
belongs_to :owner_contact, class_name: 'Contact'

View file

@ -5,7 +5,9 @@ class Nameserver < ActiveRecord::Base
'2005' => ['Hostname is invalid', 'IP is invalid']
}
EPP_OBJ = 'ns'
EPP_ATTR_MAP = {
hostname: 'hostName'
}
belongs_to :registrar
has_and_belongs_to_many :domains