From 30fe6bd1e66c58176aff046117c9dc89f278bd54 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Thu, 25 Feb 2016 17:01:41 +0200 Subject: [PATCH] Story#114471339 - move parse_legal_document_from_frame to one braking point --- app/models/epp/contact.rb | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/app/models/epp/contact.rb b/app/models/epp/contact.rb index 571cae45b..e3b972394 100644 --- a/app/models/epp/contact.rb +++ b/app/models/epp/contact.rb @@ -150,7 +150,7 @@ class Epp::Contact < Contact legal_frame = frame.css('legalDocument').first at[:legal_documents_attributes] = self.class.legal_document_attrs(legal_frame) - if doc = attach_legal_document(parse_legal_document_from_frame(frame)) + if doc = attach_legal_document(Epp::Domain.parse_legal_document_from_frame(frame)) frame.css("legalDocument").first.content = doc.path if doc && doc.persisted? self.legal_document_id = doc.id end @@ -227,7 +227,7 @@ class Epp::Contact < Contact end def add_legal_file_to_new frame - legal_document_data = Epp::Contact.parse_legal_document_from_frame(frame) + legal_document_data = Epp::Domain.parse_legal_document_from_frame(frame) return unless legal_document_data doc = LegalDocument.create( @@ -242,16 +242,4 @@ class Epp::Contact < Contact self.legal_document_id = doc.id end - - def parse_legal_document_from_frame frame - ld = frame.css('legalDocument').first - return nil unless ld - return nil if ld.text.starts_with?(ENV['legal_documents_dir']) - - { - body: ld.text, - type: ld['type'] - } - end - end