mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 01:11:43 +02:00
Refactor epp requests closer to international standard
This commit is contained in:
parent
4684b311a2
commit
9def6a7c27
11 changed files with 81 additions and 70 deletions
|
@ -11,12 +11,8 @@ module Epp::Common
|
|||
send(params[:command])
|
||||
end
|
||||
|
||||
def parsed_frame
|
||||
Nokogiri::XML(params[:frame]).remove_namespaces!
|
||||
end
|
||||
|
||||
def get_params_hash(path)
|
||||
Hash.from_xml(parsed_frame.css(path).to_xml).with_indifferent_access
|
||||
def params_hash
|
||||
@params_hash ||= Hash.from_xml(params[:frame]).with_indifferent_access
|
||||
end
|
||||
|
||||
def epp_session
|
||||
|
@ -28,13 +24,13 @@ module Epp::Common
|
|||
end
|
||||
|
||||
def validate_request
|
||||
xsd = Nokogiri::XML::Schema(File.read('doc/schemas/epp-1.0.xsd'))
|
||||
doc = Nokogiri::XML(params[:frame])
|
||||
@extValues = xsd.validate(doc)
|
||||
if @extValues.any?
|
||||
@code = '2001'
|
||||
@msg = 'Command syntax error'
|
||||
render '/epp/error' and return
|
||||
end
|
||||
# xsd = Nokogiri::XML::Schema(File.read('doc/schemas/contact-1.0.xsd'))
|
||||
# doc = Nokogiri::XML(params[:frame])
|
||||
# @extValues = xsd.validate(doc)
|
||||
# if @extValues.any?
|
||||
# @code = '2001'
|
||||
# @msg = 'Command syntax error'
|
||||
# render '/epp/error' and return
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue