This commit is contained in:
Martin Lensment 2014-06-27 16:51:26 +03:00
parent c72a2738dd
commit f8757891ef
10 changed files with 18 additions and 21 deletions

View file

@ -3,7 +3,6 @@ module Epp::Common
included do included do
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
helper_method :epp_head
end end
def proxy def proxy
@ -22,12 +21,4 @@ module Epp::Common
def current_epp_user def current_epp_user
@current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id] @current_epp_user ||= EppUser.find(epp_session[:epp_user_id]) if epp_session[:epp_user_id]
end 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 end

View file

@ -1,3 +1,3 @@
epp_head do xml.epp_head do
xml.bla xml.bla
end end

View file

@ -1,5 +1,4 @@
xml.instruct! xml.epp_head do
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.response do xml.response do
xml.result('code' => '1000') do xml.result('code' => '1000') do
xml.msg 'Command completed successfully' xml.msg 'Command completed successfully'

View file

@ -1,5 +1,4 @@
xml.instruct! xml.epp_head do
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.response do xml.response do
xml.result('code' => params[:code]) do xml.result('code' => params[:code]) do
xml.msg(params[:msg], 'lang' => 'en') xml.msg(params[:msg], 'lang' => 'en')

View file

@ -1,4 +1,4 @@
epp_head(xml) do xml.epp_head do
xml.greeting do xml.greeting do
xml.svID 'EPP server (DSDng)' xml.svID 'EPP server (DSDng)'
xml.svDate '2014-06-18T17:46:59+03:00' xml.svDate '2014-06-18T17:46:59+03:00'

View file

@ -1,5 +1,4 @@
xml.instruct! xml.epp_head do
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.response do xml.response do
xml.result('code' => '2501') do xml.result('code' => '2501') do
xml.msg('Authentication error; server closing connection') xml.msg('Authentication error; server closing connection')

View file

@ -1,5 +1,4 @@
xml.instruct! xml.epp_head do
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.response do xml.response do
xml.result('code' => '1000') do xml.result('code' => '1000') do
xml.msg 'Command completed successfully' xml.msg 'Command completed successfully'

View file

@ -1,5 +1,4 @@
xml.instruct! xml.epp_head do
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.response do xml.response do
xml.result('code' => '1500') do xml.result('code' => '1500') do
xml.msg 'Command completed successfully; ending session' xml.msg 'Command completed successfully; ending session'

View file

@ -0,0 +1 @@
Dir[File.join(Rails.root, "lib", "ext", "*.rb")].each {|x| require x }

10
lib/ext/xml_builder.rb Normal file
View 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