From 1d4d6e7ec3c587cf206ffaa326339ff6cd3d1b4f Mon Sep 17 00:00:00 2001 From: bogdanRada Date: Mon, 20 Jan 2014 12:36:17 +0200 Subject: [PATCH 1/2] option to specify custom urls --- .../{ => washout_builder}/washout_builder_controller.rb | 2 +- config/routes.rb | 5 +++++ lib/washout_builder.rb | 5 +++-- lib/washout_builder/engine.rb | 4 +--- lib/washout_builder/version.rb | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) rename app/controllers/{ => washout_builder}/washout_builder_controller.rb (92%) create mode 100644 config/routes.rb diff --git a/app/controllers/washout_builder_controller.rb b/app/controllers/washout_builder/washout_builder_controller.rb similarity index 92% rename from app/controllers/washout_builder_controller.rb rename to app/controllers/washout_builder/washout_builder_controller.rb index e7f0535..e11db6f 100644 --- a/app/controllers/washout_builder_controller.rb +++ b/app/controllers/washout_builder/washout_builder_controller.rb @@ -1,4 +1,4 @@ -class WashoutBuilderController < ActionController::Base +class WashoutBuilder::WashoutBuilderController < ActionController::Base protect_from_forgery def all diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..77da99a --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,5 @@ +WashoutBuilder::Engine.routes.draw do + root :to =>"washout_builder#all" + + +end \ No newline at end of file diff --git a/lib/washout_builder.rb b/lib/washout_builder.rb index 3527c69..7c6e498 100644 --- a/lib/washout_builder.rb +++ b/lib/washout_builder.rb @@ -18,8 +18,9 @@ class Mapper # Adds the routes for a SOAP endpoint at +controller+. def wash_out(controller_name, options={}) options.reverse_merge!(@scope) if @scope - - match "#{controller_name}/doc" => "#{controller_name}#_generate_doc", :via => :get, :format => false + + urldoc = options[:documentation_url].present? ? options[:documentation_url] : "doc" + match "#{controller_name}/#{urldoc}" => "#{controller_name}#_generate_doc", :via => :get, :format => false original_wash_out(controller_name, options) diff --git a/lib/washout_builder/engine.rb b/lib/washout_builder/engine.rb index 4333cfd..f832e7f 100644 --- a/lib/washout_builder/engine.rb +++ b/lib/washout_builder/engine.rb @@ -1,9 +1,7 @@ module WashoutBuilder class Engine < ::Rails::Engine + isolate_namespace WashoutBuilder initializer "wash_out.configuration" do |app| - app.routes.append do - match "/washout" => "washout_builder#all", :via => :get, :format => false - end if app.config.wash_out[:catch_xml_errors] app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middleware if defined?(WashOut::Middleware) app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middlewares::Catcher if defined?(WashOut::Middlewares::Catcher) diff --git a/lib/washout_builder/version.rb b/lib/washout_builder/version.rb index b1be2b8..de70f85 100644 --- a/lib/washout_builder/version.rb +++ b/lib/washout_builder/version.rb @@ -1,3 +1,3 @@ module WashoutBuilder - VERSION = "0.11.4" + VERSION = "0.11.5" end From 4155590b791afd69a238a43834c441f6e06686d4 Mon Sep 17 00:00:00 2001 From: bogdanRada Date: Mon, 20 Jan 2014 12:41:48 +0200 Subject: [PATCH 2/2] option to specify custom urls --- README.rdoc | 2 ++ lib/washout_builder.rb | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.rdoc b/README.rdoc index 009ae1d..13c5127 100644 --- a/README.rdoc +++ b/README.rdoc @@ -69,6 +69,8 @@ In the following file +config/routes.rb+ you can put this configuration wash_out :my_other_service end + mount WashoutBuilder::Engine => "/washout" + You can access the url +/washout+ and you will see a list with available services ( in our case there are only two : The RumbasController and MyOtherServiceController) with links to their documentation and where you can find the WSDL. If you want to access directly the hml documentation that was generated for RumbasController you can do that by accessing url +/rumbas/doc+ And the WSDL will be available at +/rumbas/wsdl+ diff --git a/lib/washout_builder.rb b/lib/washout_builder.rb index 7c6e498..0ebcfe9 100644 --- a/lib/washout_builder.rb +++ b/lib/washout_builder.rb @@ -18,9 +18,8 @@ class Mapper # Adds the routes for a SOAP endpoint at +controller+. def wash_out(controller_name, options={}) options.reverse_merge!(@scope) if @scope - - urldoc = options[:documentation_url].present? ? options[:documentation_url] : "doc" - match "#{controller_name}/#{urldoc}" => "#{controller_name}#_generate_doc", :via => :get, :format => false + + match "#{controller_name}/doc" => "#{controller_name}#_generate_doc", :via => :get, :format => false original_wash_out(controller_name, options)