mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Better formatting for epp doc
This commit is contained in:
parent
d95224cf9c
commit
c7812c5dd3
3 changed files with 5312 additions and 13 deletions
5276
doc/epp_doc.txt
Normal file
5276
doc/epp_doc.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -15,7 +15,7 @@ module Epp
|
||||||
end
|
end
|
||||||
|
|
||||||
res = parse_response(server.request(read_body(data)))
|
res = parse_response(server.request(read_body(data)))
|
||||||
log(data, res[:parsed])
|
log(read_body(data), res[:parsed])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
rescue => e
|
rescue => e
|
||||||
|
@ -27,8 +27,15 @@ module Epp
|
||||||
server = server_elkdata if args.include?(:elkdata)
|
server = server_elkdata if args.include?(:elkdata)
|
||||||
server = server_zone if args.include?(:zone)
|
server = server_zone if args.include?(:zone)
|
||||||
|
|
||||||
return parse_response(server.send_request(data)) if args.include?(:xml)
|
res = parse_response(server.send_request(data)) if args.include?(:xml)
|
||||||
return parse_response(server.send_request(read_body(data)))
|
if res
|
||||||
|
log(data, res[:parsed])
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
|
res = parse_response(server.send_request(read_body(data)))
|
||||||
|
log(read_body(data), res[:parsed])
|
||||||
|
return res
|
||||||
rescue => e
|
rescue => e
|
||||||
e
|
e
|
||||||
end
|
end
|
||||||
|
@ -44,7 +51,9 @@ module Epp
|
||||||
}
|
}
|
||||||
|
|
||||||
res.css('epp response result').each do |x|
|
res.css('epp response result').each do |x|
|
||||||
obj[:results] << { result_code: x[:code], msg: x.css('msg').text, value: x.css('value > *').try(:first).try(:text) }
|
obj[:results] << {
|
||||||
|
result_code: x[:code], msg: x.css('msg').text, value: x.css('value > *').try(:first).try(:text)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
obj[:result_code] = obj[:results][0][:result_code]
|
obj[:result_code] = obj[:results][0][:result_code]
|
||||||
|
@ -213,8 +222,8 @@ module Epp
|
||||||
|
|
||||||
def log(req, res)
|
def log(req, res)
|
||||||
return unless ENV['EPP_DOC']
|
return unless ENV['EPP_DOC']
|
||||||
puts "\nREQUEST: #{Nokogiri(req)}\n"
|
puts "REQUEST:\n#{Nokogiri(req)}\n"
|
||||||
puts "RESPONSE: #{res}"
|
puts "RESPONSE:\n#{res}\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,36 @@
|
||||||
class EppDoc
|
class EppDoc
|
||||||
RSpec::Core::Formatters.register self, :example_started, :example_passed, :example_failed
|
RSpec::Core::Formatters.register self, :start, :example_started, :example_passed, :example_failed
|
||||||
|
|
||||||
def initialize(output)
|
def initialize(output)
|
||||||
@output = output
|
@output = output
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_started(notification)
|
def example_started(notification)
|
||||||
desc = notification.example.full_description
|
@output.puts '-' * 100
|
||||||
@output.puts '-' * desc.length
|
@output.puts notification.example.full_description
|
||||||
@output.puts desc
|
@output.puts '-' * 100
|
||||||
@output.puts '-' * desc.length
|
end
|
||||||
|
|
||||||
|
def start(example_count)
|
||||||
|
@output.puts '-' * 100
|
||||||
|
@output.puts 'EPP REQUEST - RESPONSE DOCUMENTATION'
|
||||||
|
@output.puts "GENERATED AT: #{Time.now}"
|
||||||
|
@output.puts "EXAMPLE COUNT: #{example_count.count}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_passed(_example)
|
def example_passed(_example)
|
||||||
@output << "\n\n"
|
dash = '-' * 48
|
||||||
|
@output.puts "#{dash}PASS#{dash}\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_failed(_example)
|
def example_failed(_example)
|
||||||
@output << "\n\n"
|
dash = '-' * 48
|
||||||
|
@output.puts "#{dash}FAIL#{dash}\n\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
def example_pending(_example)
|
||||||
|
dash_1 = '-' * 47
|
||||||
|
dash_2 = '-' * 46
|
||||||
|
@output.puts "#{dash_1}PENDING#{dash_2}\n\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue