Nameserver deserializer

This commit is contained in:
Karl Erik Õunapuu 2020-11-25 15:45:43 +02:00
parent b39de0885a
commit 7459d7e0c5
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 53 additions and 21 deletions

View file

@ -1,5 +1,5 @@
require 'deserializers/xml/legal_document'
require 'deserializers/xml/nameserver'
class Epp::Domain < Domain
include EppErrors
@ -161,7 +161,7 @@ class Epp::Domain < Domain
at[:nameservers_attributes] = nameservers_attrs(frame, action)
at[:admin_domain_contacts_attributes] = admin_domain_contacts_attrs(frame, action)
at[:tech_domain_contacts_attributes] = tech_domain_contacts_attrs(frame, action)
puts "JHDFHJDGFKDJHF"
pw = frame.css('authInfo > pw').text
at[:transfer_code] = pw if pw.present?
@ -193,7 +193,7 @@ class Epp::Domain < Domain
end
def nameservers_attrs(frame, action)
ns_list = nameservers_from(frame)
ns_list = ::Deserializers::Xml::Nameservers.new(frame).call
if action == 'rem'
to_destroy = []
@ -215,21 +215,6 @@ class Epp::Domain < Domain
end
end
def nameservers_from(frame)
res = []
frame.css('hostAttr').each do |x|
host_attr = {
hostname: x.css('hostName').first.try(:text),
ipv4: x.css('hostAddr[ip="v4"]').map(&:text).compact,
ipv6: x.css('hostAddr[ip="v6"]').map(&:text).compact
}
res << host_attr.delete_if { |_k, v| v.blank? }
end
res
end
def admin_domain_contacts_attrs(frame, action)
admin_attrs = domain_contact_attrs_from(frame, action, 'admin')