mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
Refactor
This commit is contained in:
parent
c72a2738dd
commit
f8757891ef
10 changed files with 18 additions and 21 deletions
|
@ -3,7 +3,6 @@ module Epp::Common
|
|||
|
||||
included do
|
||||
protect_from_forgery with: :null_session
|
||||
helper_method :epp_head
|
||||
end
|
||||
|
||||
def proxy
|
||||
|
@ -22,12 +21,4 @@ module Epp::Common
|
|||
def current_epp_user
|
||||
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
|
||||
end
|
||||
|
||||
def epp_head xml
|
||||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
epp_head do
|
||||
xml.epp_head do
|
||||
xml.bla
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => '1000') do
|
||||
xml.msg 'Command completed successfully'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => params[:code]) do
|
||||
xml.msg(params[:msg], 'lang' => 'en')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
epp_head(xml) do
|
||||
xml.epp_head do
|
||||
xml.greeting do
|
||||
xml.svID 'EPP server (DSDng)'
|
||||
xml.svDate '2014-06-18T17:46:59+03:00'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => '2501') do
|
||||
xml.msg('Authentication error; server closing connection')
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => '1000') do
|
||||
xml.msg 'Command completed successfully'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
xml.instruct!
|
||||
xml.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
xml.epp_head do
|
||||
xml.response do
|
||||
xml.result('code' => '1500') do
|
||||
xml.msg 'Command completed successfully; ending session'
|
||||
|
|
1
config/initializers/load_class_extensions.rb
Normal file
1
config/initializers/load_class_extensions.rb
Normal file
|
@ -0,0 +1 @@
|
|||
Dir[File.join(Rails.root, "lib", "ext", "*.rb")].each {|x| require x }
|
10
lib/ext/xml_builder.rb
Normal file
10
lib/ext/xml_builder.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
require 'builder'
|
||||
|
||||
class Builder::XmlMarkup
|
||||
def epp_head
|
||||
self.instruct!
|
||||
self.epp('xmlns' => 'urn:ietf:params:xml:ns:epp-1.0', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation' => 'urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd') do
|
||||
yield
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue