From 997bfc2ee80f61a023a3d0187bc9d5757d00d754 Mon Sep 17 00:00:00 2001 From: David Gasana Manzi Date: Tue, 22 Mar 2022 22:39:51 +0200 Subject: [PATCH 1/4] try supportint rails 5 on the current minor version --- .travis.yml | 16 ++++++++++------ Appraisals | 8 ++++++++ lib/wash_out/dispatcher.rb | 23 +++++++++++++++++------ lib/wash_out/version.rb | 2 +- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7057e58c..931b75bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,11 @@ -before_install: - - gem install bundler +script: bundle exec rspec +gemfile: + - gemfiles/rails_4.0.0.gemfile + - gemfiles/rails_4.1.0.gemfile + - gemfiles/rails_4.2.0.gemfile + - gemfiles/rails_5.0.0.gemfile + - gemfiles/rails_5.1.1.gemfile rvm: - - 1.9.3 - - jruby-19mode - - 2.0.0 - - 2.1.0 + - 2.3.0 +before_install: + - gem update bundler \ No newline at end of file diff --git a/Appraisals b/Appraisals index 1298ae93..26c6ae01 100644 --- a/Appraisals +++ b/Appraisals @@ -21,3 +21,11 @@ end appraise "rails-4.2.0" do gem "rails", "4.2.0" end + +appraise "rails-5.0.0" do + gem "rails", "5.0.0" +end + +appraise "rails-5.1.0" do + gem "rails", "5.1.0" +end \ No newline at end of file diff --git a/lib/wash_out/dispatcher.rb b/lib/wash_out/dispatcher.rb index 87ec0121..0e7c2868 100644 --- a/lib/wash_out/dispatcher.rb +++ b/lib/wash_out/dispatcher.rb @@ -18,7 +18,7 @@ class ProgrammerError < Exception; end def _authenticate_wsse begin - xml_security = env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first + xml_security = request.env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first xml_security = xml_security.values_at(:header, :Header).compact.first xml_security = xml_security.values_at(:security, :Security).compact.first username_token = xml_security.values_at(:username_token, :UsernameToken).compact.first @@ -153,13 +153,24 @@ def render_soap_error(message, code=nil) end def self.included(controller) - controller.send :around_filter, :_catch_soap_errors + entity = if defined?(Rails::VERSION::MAJOR) && (Rails::VERSION::MAJOR >= 4) + 'action' + else + 'filter' + end + + controller.send :"around_#{entity}", :_catch_soap_errors controller.send :helper, :wash_out - controller.send :before_filter, :_authenticate_wsse, :except => [ + controller.send :"before_#{entity}", :_authenticate_wsse, :except => [ :_generate_wsdl, :_invalid_action ] - controller.send :before_filter, :_map_soap_parameters, :except => [ + controller.send :"before_#{entity}", :_map_soap_parameters, :except => [ :_generate_wsdl, :_invalid_action ] - controller.send :skip_before_filter, :verify_authenticity_token + + if defined?(Rails::VERSION::MAJOR) && (Rails::VERSION::MAJOR >= 5) + controller.send :"skip_before_#{entity}", :verify_authenticity_token, :raise => false + else + controller.send :"skip_before_#{entity}", :verify_authenticity_token + end end def self.deep_select(hash, result=[], &blk) @@ -193,7 +204,7 @@ def soap_action end def xml_data - xml_data = env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first + xml_data = request.env['wash_out.soap_data'].values_at(:envelope, :Envelope).compact.first xml_data = xml_data.values_at(:body, :Body).compact.first xml_data = xml_data.values_at(soap_action.underscore.to_sym, soap_action.to_sym).compact.first || {} end diff --git a/lib/wash_out/version.rb b/lib/wash_out/version.rb index 75f7e2e1..da7e2687 100644 --- a/lib/wash_out/version.rb +++ b/lib/wash_out/version.rb @@ -1,3 +1,3 @@ module WashOut - VERSION = "0.9.2" + VERSION = "0.9.3" end From 47e5bf4f00ef5b5d6bce0a81402c34318c00cf0a Mon Sep 17 00:00:00 2001 From: David Gasana Manzi Date: Tue, 22 Mar 2022 23:20:40 +0200 Subject: [PATCH 2/4] Update Appraisals Co-authored-by: Marivaldo Cavalheiro --- Appraisals | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Appraisals b/Appraisals index 26c6ae01..44fed50b 100644 --- a/Appraisals +++ b/Appraisals @@ -28,4 +28,4 @@ end appraise "rails-5.1.0" do gem "rails", "5.1.0" -end \ No newline at end of file +end From 0003e3ea0674a1c96f9c4c38ac4c2f12de451bc4 Mon Sep 17 00:00:00 2001 From: David Gasana Manzi Date: Tue, 22 Mar 2022 23:21:17 +0200 Subject: [PATCH 3/4] Update .travis.yml Thank you for this suggestions Co-authored-by: Marivaldo Cavalheiro --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 931b75bb..9d808220 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,4 @@ gemfile: rvm: - 2.3.0 before_install: - - gem update bundler \ No newline at end of file + - gem update bundler From 2845a3bf6011171de1190f48376fcc5c18f7fcf2 Mon Sep 17 00:00:00 2001 From: David Gasana Manzi Date: Mon, 29 Aug 2022 10:24:28 +0200 Subject: [PATCH 4/4] appraise to rails 6 --- Appraisals | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Appraisals b/Appraisals index 44fed50b..63017847 100644 --- a/Appraisals +++ b/Appraisals @@ -29,3 +29,7 @@ end appraise "rails-5.1.0" do gem "rails", "5.1.0" end + +appraise "rails-6.1.4.1" do + gem "rails", "6.1.4.1" +end