Create legal documents

This commit is contained in:
Martin Lensment 2014-12-29 17:19:27 +02:00
parent 4f10cccdfa
commit e09ddd3138
10 changed files with 274 additions and 7 deletions

View file

@ -54,6 +54,7 @@ class Epp::EppDomain < Domain
attach_contacts(self.class.parse_contacts_from_frame(parsed_frame))
attach_nameservers(self.class.parse_nameservers_from_frame(parsed_frame))
attach_statuses(self.class.parse_statuses_from_frame(parsed_frame))
attach_legal_document(self.class.parse_legal_document_from_frame(parsed_frame))
errors.empty?
end
@ -92,6 +93,15 @@ class Epp::EppDomain < Domain
errors.empty?
end
def attach_legal_document(legal_document_data)
return unless legal_document_data
legal_documents.build(
document_type: legal_document_data[:type],
body: legal_document_data[:body]
)
end
def attach_owner_contact(code)
return unless code
self.owner_contact = Contact.find_by(code: code)
@ -528,6 +538,16 @@ class Epp::EppDomain < Domain
res
end
def parse_legal_document_from_frame(parsed_frame)
ld = parsed_frame.css('legalDocument').first
return nil unless ld
{
body: ld.text,
type: ld['type']
}
end
def check_availability(domains)
domains = [domains] if domains.is_a?(String)