Routes fix

This commit is contained in:
Martin Lensment 2015-01-16 13:40:05 +02:00
parent db77334711
commit ea51bb50b2
3 changed files with 6 additions and 7 deletions

View file

@ -120,12 +120,11 @@ module Epp::Common
end
def write_to_epp_log
request_object = OBJECT_TYPES[params_hash['epp']['xmlns:ns2']] if params[:frame]
ApiLog::EppLog.create({
request: params[:raw_frame],
request_command: params[:action],
request_successful: epp_errors.empty?,
request_object: request_object,
request_object: params[:epp_object_type], # TODO: fix this for login and logout
response: @response,
api_user_name: @epp_user.try(:to_s) || current_epp_user.try(:to_s),
api_user_registrar: @epp_user.try(:registrar).try(:to_s) || current_epp_user.try(:registrar).try(:to_s),

View file

@ -30,8 +30,6 @@ module Registry
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
config.autoload_paths << Rails.root.join('lib')
# Active Record used to suppresses errors raised within
# `after_rollback`/`after_commit` callbacks and only printed them to the logs.
# In the next version, these errors will no longer be suppressed.

View file

@ -11,9 +11,11 @@ class EppConstraint
def matches?(request)
element = "//#{@type}:#{request.params[:action]}"
parsed_frame = Nokogiri::XML(request.params[:raw_frame])
ret = parsed_frame.xpath("#{element}", OBJECT_TYPES[@type]).any?
request.params[:parsed_frame] = parsed_frame.remove_namespaces! if ret
ret
return false if parsed_frame.xpath("#{element}", OBJECT_TYPES[@type]).none?
request.params[:parsed_frame] = parsed_frame.remove_namespaces!
request.params[:epp_object_type] = @type
true
end
end