mirror of
https://github.com/internetee/registry.git
synced 2025-07-19 17:25:57 +02:00
Refactor contact type parsing to dynamic
This commit is contained in:
parent
8bff2fb34c
commit
292daa66e0
2 changed files with 13 additions and 19 deletions
|
@ -36,13 +36,12 @@ module Epp::DomainsHelper
|
|||
def domain_contacts
|
||||
parsed_frame = Nokogiri::XML(params[:frame]).remove_namespaces!
|
||||
|
||||
res = {tech: [], admin: []}
|
||||
parsed_frame.css('contact[type="tech"]').each do |x|
|
||||
res[:tech] << Hash.from_xml(x.to_s).with_indifferent_access
|
||||
end
|
||||
|
||||
parsed_frame.css('contact[type="admin"]').each do |x|
|
||||
res[:admin] << Hash.from_xml(x.to_s).with_indifferent_access
|
||||
res = {}
|
||||
Contact::CONTACT_TYPES.each do |ct|
|
||||
res[ct.to_sym] ||= []
|
||||
parsed_frame.css("contact[type='#{ct}']").each do |x|
|
||||
res[ct.to_sym] << Hash.from_xml(x.to_s).with_indifferent_access
|
||||
end
|
||||
end
|
||||
|
||||
res
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue