Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/wash_out.rb

Instance Method Summary collapse

Instance Method Details

#wash_out(controller_name, options = {}) ⇒ Object

Adds the routes for a SOAP endpoint at controller.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wash_out.rb', line 23

def wash_out(controller_name, options={})
  if @scope
    scope_frame = @scope.respond_to?(:frame) ? @scope.frame : @scope
    options.each{ |key, value|  scope_frame[key] = value }
  end

  controller_class_name = [scope_frame[:module], controller_name].compact.join("/").underscore

  match "#{controller_name}/wsdl"   => "#{controller_name}#_generate_wsdl", :via => :get, :format => false,
    :as => "#{controller_class_name}_wsdl"
  match "#{controller_name}/action" => WashOut::Router.new(controller_class_name), :via => [:get, :post],
    :defaults => { :controller => controller_class_name, :action => 'soap' }, :format => false,
    :as => "#{controller_class_name}_soap"
end