mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Automatic error handling
This commit is contained in:
parent
dce3357e1e
commit
fb8cba9ef4
6 changed files with 73 additions and 40 deletions
|
@ -23,13 +23,21 @@ module Epp
|
|||
def parse_response raw
|
||||
res = Nokogiri::XML(raw)
|
||||
|
||||
{
|
||||
result_code: res.css('epp response result').first[:code],
|
||||
msg: res.css('epp response result msg').text,
|
||||
obj = {
|
||||
results: [],
|
||||
clTRID: res.css('epp trID clTRID').text,
|
||||
parsed: res.remove_namespaces!,
|
||||
raw: raw
|
||||
}
|
||||
|
||||
res.css('epp response result').each do |x|
|
||||
obj[:results] << {result_code: x[:code], msg: x.css('msg').text}
|
||||
end
|
||||
|
||||
obj[:result_code] = obj[:results][0][:result_code]
|
||||
obj[:msg] = obj[:results][0][:msg]
|
||||
|
||||
obj
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue