Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try supporting rails 5 on the current minor version #276

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
GASANAMDavid marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -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
GASANAMDavid marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 17 additions & 6 deletions lib/wash_out/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/wash_out/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WashOut
VERSION = "0.9.2"
VERSION = "0.9.3"
end