mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Add helper for extracting epp attributes
This commit is contained in:
parent
27d19ad237
commit
16ca5eb44c
2 changed files with 65 additions and 6 deletions
30
lib/epp_parser.rb
Normal file
30
lib/epp_parser.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
module EppParser
|
||||
def domain_rem_params
|
||||
|
||||
|
||||
{
|
||||
nameservers_attributes: to_destroy
|
||||
}
|
||||
end
|
||||
|
||||
def nameservers_attributes
|
||||
ns_list = Epp::EppDomain.parse_nameservers_from_frame(params[:parsed_frame])
|
||||
|
||||
to_destroy = []
|
||||
ns_list.each do |ns_attrs|
|
||||
nameserver = @domain.nameservers.where(ns_attrs).try(:first)
|
||||
if nameserver.blank?
|
||||
epp_errors << {
|
||||
code: '2303',
|
||||
msg: I18n.t('nameserver_not_found'),
|
||||
value: { obj: 'hostAttr', val: ns_attrs[:hostname] }
|
||||
}
|
||||
else
|
||||
to_destroy << {
|
||||
id: nameserver.id,
|
||||
_destroy: 1
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue