Refactor epp_head to helper

This commit is contained in:
Martin Lensment 2014-06-27 16:33:00 +03:00
parent d66527ac80
commit c72a2738dd
4 changed files with 19 additions and 2 deletions

View file

@ -3,6 +3,7 @@ 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
@ -21,4 +22,12 @@ 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

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

View file

@ -1,5 +1,4 @@
xml.instruct! epp_head(xml) 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.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

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?><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"><command><check><domain:check xmlns:domain="http://www.nic.cz/xml/epp/domain-1.4" xsi:schemaLocation="http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd"><domain:name>test.ee</domain:name>
</domain:check>
</check>
<clTRID>imkt004#14-06-27at16:13:33</clTRID>
</command>
</epp>