mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +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
|
||||
|
||||
res = parse_response(server.request(read_body(data)))
|
||||
log(data, res[:parsed])
|
||||
log(read_body(data), res[:parsed])
|
||||
return res
|
||||
|
||||
rescue => e
|
||||
|
@ -27,8 +27,15 @@ module Epp
|
|||
server = server_elkdata if args.include?(:elkdata)
|
||||
server = server_zone if args.include?(:zone)
|
||||
|
||||
return parse_response(server.send_request(data)) if args.include?(:xml)
|
||||
return parse_response(server.send_request(read_body(data)))
|
||||
res = parse_response(server.send_request(data)) if args.include?(:xml)
|
||||
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
|
||||
e
|
||||
end
|
||||
|
@ -44,7 +51,9 @@ module Epp
|
|||
}
|
||||
|
||||
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
|
||||
|
||||
obj[:result_code] = obj[:results][0][:result_code]
|
||||
|
@ -213,8 +222,8 @@ module Epp
|
|||
|
||||
def log(req, res)
|
||||
return unless ENV['EPP_DOC']
|
||||
puts "\nREQUEST: #{Nokogiri(req)}\n"
|
||||
puts "RESPONSE: #{res}"
|
||||
puts "REQUEST:\n#{Nokogiri(req)}\n"
|
||||
puts "RESPONSE:\n#{res}\n"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,22 +1,36 @@
|
|||
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)
|
||||
@output = output
|
||||
end
|
||||
|
||||
def example_started(notification)
|
||||
desc = notification.example.full_description
|
||||
@output.puts '-' * desc.length
|
||||
@output.puts desc
|
||||
@output.puts '-' * desc.length
|
||||
@output.puts '-' * 100
|
||||
@output.puts notification.example.full_description
|
||||
@output.puts '-' * 100
|
||||
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
|
||||
|
||||
def example_passed(_example)
|
||||
@output << "\n\n"
|
||||
dash = '-' * 48
|
||||
@output.puts "#{dash}PASS#{dash}\n\n"
|
||||
end
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue