Add basic contact creation request to EPP

This commit is contained in:
Martin Lensment 2014-07-02 16:37:11 +03:00
parent d0251de28f
commit 2187be6364
6 changed files with 100 additions and 1 deletions

View file

@ -14,6 +14,22 @@ module Epp::Common
Nokogiri::XML(params[:frame]).remove_namespaces!
end
def get_params_hash(path)
node_set = parsed_frame.css(path).children.select{ |x| x.element? && x.element_children.empty? }
node_set.inject({}) do |hash, obj|
#convert to array if 1 or more attributes with same name
if hash[obj.name.to_sym] && !hash[obj.name.to_sym].is_a?(Array)
hash[obj.name.to_sym] = [hash[obj.name.to_sym]]
hash[obj.name.to_sym] << obj.text.strip
else
hash[obj.name.to_sym] = obj.text.strip
end
hash
end
end
def epp_session
EppSession.find_or_initialize_by(session_id: cookies['session'])
end

View file

@ -1,9 +1,11 @@
class Epp::CommandsController < ApplicationController
include Epp::Common
include Epp::DomainsHelper
include Epp::ContactsHelper
OBJECT_TYPES = {
'http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd' => 'domain'
'http://www.nic.cz/xml/epp/domain-1.4 domain-1.4.xsd' => 'domain',
'http://www.nic.cz/xml/epp/contact-1.6 contact-1.6.xsd' => 'contact'
}
private