mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Basic domain check command implementation
This commit is contained in:
parent
f8757891ef
commit
cd52da3f8f
8 changed files with 49 additions and 9 deletions
|
@ -12,4 +12,9 @@ class Epp::CommandsController < ApplicationController
|
|||
type = OBJECT_TYPES[parsed_frame.css('create create').attr('schemaLocation').value]
|
||||
send("create_#{type}")
|
||||
end
|
||||
|
||||
def check
|
||||
type = OBJECT_TYPES[parsed_frame.css('check check').attr('schemaLocation').value]
|
||||
send("check_#{type}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Epp::CommandsHelper
|
||||
def command_params
|
||||
node_set = parsed_frame.css('epp command create create').children.select(&:element?)
|
||||
def command_params_for type
|
||||
node_set = parsed_frame.css("epp command #{type} #{type}").children.select(&:element?)
|
||||
node_set.inject({}) {|hash, obj| hash[obj.name.to_sym] = obj.text;hash }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,8 +4,17 @@ module Epp::DomainsHelper
|
|||
render '/epp/domains/create'
|
||||
end
|
||||
|
||||
def check_domain
|
||||
cp = command_params_for('check')
|
||||
@domain = cp[:name]
|
||||
|
||||
render '/epp/domains/check'
|
||||
end
|
||||
|
||||
### HELPER METHODS ###
|
||||
|
||||
def domain_params
|
||||
cp = command_params
|
||||
cp = command_params_for('create')
|
||||
{
|
||||
name: cp[:name],
|
||||
registrar_id: current_epp_user.registrar.try(:id),
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
xml.epp_head do
|
||||
xml.bla
|
||||
xml.response do
|
||||
xml.result('code' => '1000') do
|
||||
xml.msg 'Command completed successfully'
|
||||
end
|
||||
|
||||
xml.resData do
|
||||
xml.tag!('domain:chkData', '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') do
|
||||
xml.tag!('domain:cd') do
|
||||
xml.tag!('domain:name', @domain, 'avail' => 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
xml << render('/epp/shared/trID')
|
||||
end
|
||||
end
|
||||
|
|
4
app/views/epp/shared/_trID.xml.builder
Normal file
4
app/views/epp/shared/_trID.xml.builder
Normal file
|
@ -0,0 +1,4 @@
|
|||
xml.trID do
|
||||
xml.clTRID params[:clTRID]
|
||||
xml.svTRID @svTRID
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue