XML builder for generating xml response files, test dummy for epp

This commit is contained in:
Martin Lensment 2014-06-18 18:30:50 +03:00
parent 3bedf17d9a
commit e46cdbd6fc
7 changed files with 31 additions and 22 deletions

View file

@ -81,6 +81,7 @@ Add:
</IfModule> </IfModule>
``` ```
* `a2ensite epp`
* `sudo service apache2 restart` * `sudo service apache2 restart`
Try it out: Try it out:

View file

@ -1,9 +1,14 @@
class Epp::SessionsController < ApplicationController class Epp::SessionsController < ApplicationController
def index protect_from_forgery with: :null_session
render 'hello'
def greeting; end
def proxy
send(params[:command])
end end
def create private
def login
render 'login' render 'login'
end end
end end

View file

@ -0,0 +1,15 @@
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.svID 'EPP server (DSDng)'
xml.svDate '2014-06-18T17:46:59+03:00'
xml.version '1.0'
xml.lang 'en'
xml.lang 'cs'
xml.objURI 'http://www.nic.cz/xml/epp/contact-1.6'
xml.objURI 'http://www.nic.cz/xml/epp/domain-1.4'
xml.objURI 'http://www.nic.cz/xml/epp/nsset-1.2'
xml.objURI 'http://www.nic.cz/xml/epp/keyset-1.3'
xml.svcExtension do
xml.extURI 'http://www.nic.cz/xml/epp/enumval-1.2'
end
end

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- This is an example EPP greeting from mod_epp -->
<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">
<greeting>
<svID>Example mod_epp server</svID>
<svDate>2002-10-28T22:00:00.0Z</svDate>
<svcMenu>
<version>1.0</version>
<lang>en</lang>
</svcMenu>
</greeting>
</epp>

View file

@ -1,7 +1,7 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace(:epp) do namespace(:epp) do
get 'session/:command', to: 'sessions#index', defaults: { format: :xml } get 'session/hello', to: 'sessions#greeting', defaults: { format: :xml }
post 'session/:command', to: 'sessions#create', defaults: { format: :xml } post 'session/:command', to: 'sessions#proxy', defaults: { format: :xml }
end end
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.

5
spec/epp/session_spec.rb Normal file
View file

@ -0,0 +1,5 @@
require 'rails_helper'
describe "EPP Session" do
it "greets client upon connection"
end

0
spec/session_spec.rb Normal file
View file