wash_out 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,62 +1,64 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wash_out (0.5.3)
5
- nori
4
+ wash_out (0.5.5)
5
+ nori (~> 1.1.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionpack (3.2.1)
11
- activemodel (= 3.2.1)
12
- activesupport (= 3.2.1)
10
+ actionpack (3.2.9)
11
+ activemodel (= 3.2.9)
12
+ activesupport (= 3.2.9)
13
13
  builder (~> 3.0.0)
14
14
  erubis (~> 2.7.0)
15
- journey (~> 1.0.1)
15
+ journey (~> 1.0.4)
16
16
  rack (~> 1.4.0)
17
- rack-cache (~> 1.1)
17
+ rack-cache (~> 1.2)
18
18
  rack-test (~> 0.6.1)
19
- sprockets (~> 2.1.2)
20
- activemodel (3.2.1)
21
- activesupport (= 3.2.1)
19
+ sprockets (~> 2.2.1)
20
+ activemodel (3.2.9)
21
+ activesupport (= 3.2.9)
22
22
  builder (~> 3.0.0)
23
- activesupport (3.2.1)
23
+ activesupport (3.2.9)
24
24
  i18n (~> 0.6)
25
25
  multi_json (~> 1.0)
26
- akami (1.0.0)
26
+ akami (1.2.0)
27
27
  gyoku (>= 0.4.0)
28
- appraisal (0.4.1)
28
+ nokogiri (>= 1.4.0)
29
+ appraisal (0.5.1)
29
30
  bundler
30
31
  rake
31
- builder (3.0.0)
32
+ builder (3.0.4)
32
33
  coderay (1.0.8)
33
34
  diff-lcs (1.1.3)
34
35
  erubis (2.7.0)
35
- ffi (1.1.5)
36
- ffi (1.1.5-java)
37
- guard (1.5.0)
38
- listen (>= 0.4.2)
36
+ ffi (1.2.0)
37
+ ffi (1.2.0-java)
38
+ guard (1.6.1)
39
+ listen (>= 0.6.0)
39
40
  lumberjack (>= 1.0.2)
40
41
  pry (>= 0.9.10)
41
42
  thor (>= 0.14.6)
42
- guard-rspec (1.2.1)
43
+ guard-rspec (2.3.3)
43
44
  guard (>= 1.1)
44
- gyoku (0.4.4)
45
+ rspec (~> 2.11)
46
+ gyoku (1.0.0)
45
47
  builder (>= 2.1.2)
46
48
  hike (1.2.1)
47
- httpi (0.9.6)
49
+ httpi (0.9.7)
48
50
  rack
49
- i18n (0.6.0)
50
- journey (1.0.3)
51
- json (1.6.5)
52
- json (1.6.5-java)
53
- listen (0.5.3)
51
+ i18n (0.6.1)
52
+ journey (1.0.4)
53
+ json (1.7.5)
54
+ json (1.7.5-java)
55
+ listen (0.6.0)
54
56
  lumberjack (1.0.2)
55
57
  method_source (0.8.1)
56
- multi_json (1.1.0)
57
- nokogiri (1.5.0)
58
- nokogiri (1.5.0-java)
59
- nori (1.1.0)
58
+ multi_json (1.5.0)
59
+ nokogiri (1.5.6)
60
+ nokogiri (1.5.6-java)
61
+ nori (1.1.3)
60
62
  pry (0.9.10)
61
63
  coderay (~> 1.0.5)
62
64
  method_source (~> 0.8)
@@ -67,38 +69,40 @@ GEM
67
69
  slop (~> 3.3.1)
68
70
  spoon (~> 0.0)
69
71
  rack (1.4.1)
70
- rack-cache (1.1)
72
+ rack-cache (1.2)
71
73
  rack (>= 0.4)
72
74
  rack-ssl (1.3.2)
73
75
  rack
74
- rack-test (0.6.1)
76
+ rack-test (0.6.2)
75
77
  rack (>= 1.0)
76
- railties (3.2.1)
77
- actionpack (= 3.2.1)
78
- activesupport (= 3.2.1)
78
+ railties (3.2.9)
79
+ actionpack (= 3.2.9)
80
+ activesupport (= 3.2.9)
79
81
  rack-ssl (~> 1.3.2)
80
82
  rake (>= 0.8.7)
81
83
  rdoc (~> 3.4)
82
- thor (~> 0.14.6)
83
- rake (10.0.2)
84
+ thor (>= 0.14.6, < 2.0)
85
+ rake (10.0.3)
84
86
  rb-fsevent (0.9.2)
85
87
  rb-inotify (0.8.8)
86
88
  ffi (>= 0.5.0)
87
89
  rdoc (3.12)
88
90
  json (~> 1.4)
89
- rspec (2.8.0)
90
- rspec-core (~> 2.8.0)
91
- rspec-expectations (~> 2.8.0)
92
- rspec-mocks (~> 2.8.0)
93
- rspec-core (2.8.0)
94
- rspec-expectations (2.8.0)
95
- diff-lcs (~> 1.1.2)
96
- rspec-mocks (2.8.0)
97
- rspec-rails (2.8.1)
91
+ rspec (2.12.0)
92
+ rspec-core (~> 2.12.0)
93
+ rspec-expectations (~> 2.12.0)
94
+ rspec-mocks (~> 2.12.0)
95
+ rspec-core (2.12.2)
96
+ rspec-expectations (2.12.1)
97
+ diff-lcs (~> 1.1.3)
98
+ rspec-mocks (2.12.1)
99
+ rspec-rails (2.12.0)
98
100
  actionpack (>= 3.0)
99
101
  activesupport (>= 3.0)
100
102
  railties (>= 3.0)
101
- rspec (~> 2.8.0)
103
+ rspec-core (~> 2.12.0)
104
+ rspec-expectations (~> 2.12.0)
105
+ rspec-mocks (~> 2.12.0)
102
106
  savon (0.9.9)
103
107
  akami (~> 1.0)
104
108
  builder (>= 2.1.2)
@@ -109,13 +113,14 @@ GEM
109
113
  wasabi (~> 2.1)
110
114
  slop (3.3.3)
111
115
  spoon (0.0.1)
112
- sprockets (2.1.2)
116
+ sprockets (2.2.2)
113
117
  hike (~> 1.2)
118
+ multi_json (~> 1.0)
114
119
  rack (~> 1.0)
115
120
  tilt (~> 1.1, != 1.3.0)
116
- thor (0.14.6)
121
+ thor (0.16.0)
117
122
  tilt (1.3.3)
118
- tzinfo (0.3.31)
123
+ tzinfo (0.3.35)
119
124
  wasabi (2.1.0)
120
125
  nokogiri (>= 1.4.0)
121
126
 
@@ -131,6 +136,7 @@ DEPENDENCIES
131
136
  rb-fsevent
132
137
  rb-inotify
133
138
  rspec-rails
134
- savon
139
+ savon (= 0.9.9)
135
140
  tzinfo
141
+ wasabi (= 2.1.0)
136
142
  wash_out!
data/README.md CHANGED
@@ -10,7 +10,7 @@ Rails >3.0 only. MRI 1.9, JRuby (--1.9), Rubinius (--1.9).
10
10
 
11
11
  Ruby 1.8 is not officially supported since 0.5.3. We will accept further compatibilty pull-requests but no upcoming versions will be tested against it.
12
12
 
13
- ![Travis CI](https://secure.travis-ci.org/roundlake/wash_out.png)
13
+ ![Travis CI](https://secure.travis-ci.org/inossidabile/wash_out.png)
14
14
 
15
15
  ## Installation
16
16
 
@@ -109,8 +109,6 @@ result.to_hash # => {:concat_reponse => {:value=>"123abc"}}
109
109
  result.to_hash # => {:value=>"123abc"}
110
110
  ```
111
111
 
112
- Take a look at [WashOut sample application](https://github.com/roundlake/wash_out-sample).
113
-
114
112
  ## Reusable types
115
113
 
116
114
  Basic inline types definition is fast and furious for the simple cases. You have an option to describe SOAP types
@@ -141,6 +139,7 @@ Use `config.wash_out...` inside your environment configuration to setup WashOut.
141
139
 
142
140
  Available properties are:
143
141
 
142
+ * **catch_xml_errors**: intercept Rails parsing exceptions to return correct XML response for corrupt XML input. Default is `false`.
144
143
  * **namespace**: SOAP namespace to use. Default is `urn:WashOut`.
145
144
  * **snakecase**: *(DEPRECATED SINCE 0.4.0)* Determines if WashOut should modify parameters keys to snakecase. Default is `false`.
146
145
  * **snakecase_input**: Determines if WashOut should modify parameters keys to snakecase. Default is `false`.
@@ -168,6 +167,7 @@ soap_action "foo" # this will be passed as is
168
167
  * Tobias Bielohlawek ([@rngtng](https://github.com/rngtng))
169
168
  * Francesco Negri ([@dhinus](https://github.com/dhinus))
170
169
  * Edgars Beigarts ([@ebeigarts](https://github.com/ebeigarts))
170
+ * [Exad](https://github.com/exad) ([@wknechtel](https://github.com/wknechtel) and [@☈king](https://github.com/rking))
171
171
 
172
172
  ## LICENSE
173
173
 
@@ -2,8 +2,10 @@ module WashOut
2
2
  class Engine < ::Rails::Engine
3
3
  class << self
4
4
  attr_accessor :namespace
5
- attr_accessor :snakecase, :snakecase_input, :camelize_wsdl
5
+ attr_accessor :snakecase, :camelize_output
6
+ attr_accessor :snakecase_input, :camelize_wsdl
6
7
  attr_accessor :wsse_username, :wsse_password
8
+ attr_accessor :catch_xml_errors
7
9
  end
8
10
 
9
11
  self.namespace = 'urn:WashOut'
@@ -22,9 +24,19 @@ module WashOut
22
24
  self.class.send "#{key}=", value
23
25
  end
24
26
 
27
+ app.config.wash_out.catch_xml_errors ||= false
28
+
25
29
  unless self.class.snakecase.nil?
26
30
  raise "Usage of wash_out.snakecase is deprecated. You should use wash_out.snakecase_input and wash_out.camelize_wsdl"
27
31
  end
32
+
33
+ unless self.class.camelize_output.nil?
34
+ raise "Usage of wash_out.camelize_output is deprecated. You should use wash_out.camelize_wsdl option instead"
35
+ end
36
+
37
+ if self.class.catch_xml_errors
38
+ app.config.middleware.insert_after 'ActionDispatch::ShowExceptions', WashOut::Middleware
39
+ end
28
40
  end
29
41
  end
30
42
  end
@@ -0,0 +1,41 @@
1
+ class WashOut::Middleware
2
+ def initialize app
3
+ @app = app
4
+ end
5
+
6
+ def call env
7
+ begin
8
+ @app.call env
9
+ rescue REXML::ParseException => e
10
+ self.class.raise_or_render_rexml_parse_error e, env
11
+ end
12
+ end
13
+
14
+ def self.raise_or_render_rexml_parse_error e, env
15
+ raise e unless env.has_key? 'HTTP_SOAPACTION'
16
+
17
+ # Normally input would be a StringIO, but Passenger has a different API:
18
+ input = env['rack.input']
19
+ req = if input.respond_to? :string then input.string else input.read end
20
+
21
+ env['rack.errors'].puts <<-EOERR
22
+ WashOut::Exception: #{e.continued_exception} for:
23
+ #{req}
24
+ EOERR
25
+ [400, {'Content-Type' => 'text/xml'},
26
+ [render_client_soap_fault("Error parsing SOAP Request XML")]]
27
+ end
28
+
29
+ def self.render_client_soap_fault msg
30
+ xml = Builder::XmlMarkup.new
31
+ xml.tag! 'soap:Envelope', 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/',
32
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' do
33
+ xml.tag! 'soap:Body' do
34
+ xml.tag! 'soap:Fault', :encodingStyle => 'http://schemas.xmlsoap.org/soap/encoding/' do
35
+ xml.faultcode 'Client'
36
+ xml.faultstring msg
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,5 +1,9 @@
1
1
  module WashOut
2
2
  module Model
3
+ def wash_out_columns
4
+ columns_hash
5
+ end
6
+
3
7
  def wash_out_param_map
4
8
  types = {
5
9
  :text => :string,
@@ -9,7 +13,7 @@ module WashOut
9
13
  }
10
14
  map = {}
11
15
 
12
- columns_hash.each do |key, column|
16
+ wash_out_columns.each do |key, column|
13
17
  type = column.type
14
18
  type = types[type] if types.has_key?(type)
15
19
  map[key] = type
@@ -1,3 +1,3 @@
1
1
  module WashOut
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.6"
3
3
  end
data/lib/wash_out.rb CHANGED
@@ -6,6 +6,7 @@ require 'wash_out/router'
6
6
  require 'wash_out/type'
7
7
  require 'wash_out/model'
8
8
  require 'wash_out/wsse'
9
+ require 'wash_out/middleware'
9
10
 
10
11
  module ActionDispatch::Routing
11
12
  class Mapper
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+ require 'wash_out/middleware'
3
+ require 'rexml/document'
4
+
5
+ describe WashOut::Middleware do
6
+ it 'handles Rack environment variables' do
7
+ err = begin
8
+ REXML::Document.new '<hi>'
9
+ rescue REXML::ParseException => e
10
+ e
11
+ end
12
+
13
+ env = {}
14
+ lambda {
15
+ WashOut::Middleware.raise_or_render_rexml_parse_error err, env
16
+ }.should raise_exception
17
+
18
+ env['HTTP_SOAPACTION'] = 'pretend_action'
19
+ env['rack.errors'] = double 'logger', {:puts => true}
20
+ env['rack.input'] = double 'basic-rack-input', {:string => '<hi>'}
21
+ result = WashOut::Middleware.raise_or_render_rexml_parse_error err, env
22
+ result[0].should == 400
23
+ result[1]['Content-Type'].should == 'text/xml'
24
+ msg = result[2][0]
25
+ msg.should include 'Error parsing SOAP Request XML'
26
+ msg.should include 'soap:Fault'
27
+ msg.should_not include __FILE__
28
+
29
+ env['rack.input'] = double 'passenger-input', {:read => '<hi>'}
30
+ result = WashOut::Middleware.raise_or_render_rexml_parse_error err, env
31
+ result[0].should == 400
32
+ end
33
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,6 +4,8 @@ ENV["RAILS_ENV"] = "test"
4
4
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
5
  require "rails/test_help"
6
6
  require "rspec/rails"
7
+ require "pry"
8
+ require "savon"
7
9
 
8
10
  Rails.backtrace_cleaner.remove_silencers!
9
11
 
@@ -26,8 +28,6 @@ RSpec.configure do |config|
26
28
  end
27
29
  end
28
30
 
29
- require 'savon'
30
-
31
31
  Savon.configure do |config|
32
32
  config.log = false # disable logging
33
33
  end
data/wash_out.gemspec CHANGED
@@ -6,16 +6,17 @@ Gem::Specification.new do |s|
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.summary = "Dead simple Rails 3 SOAP server library"
8
8
  s.email = "boris@roundlake.ru"
9
- s.homepage = "http://roundlake.github.com/wash_out/"
9
+ s.homepage = "http://github.com/inossidabile/wash_out/"
10
10
  s.description = "Dead simple Rails 3 SOAP server library"
11
11
  s.authors = ['Boris Staal', 'Peter Zotov']
12
12
 
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.require_paths = ["lib"]
15
15
 
16
- s.add_dependency("nori")
16
+ s.add_dependency("nori", "~> 1.1.0")
17
+ s.add_development_dependency("wasabi", "= 2.1.0")
18
+ s.add_development_dependency("savon", "= 0.9.9")
17
19
  %w(
18
- savon
19
20
  rspec-rails guard guard-rspec rb-inotify rb-fsevent
20
21
  appraisal
21
22
  tzinfo
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wash_out
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,33 +10,44 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-11 00:00:00.000000000 Z
13
+ date: 2012-12-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nori
17
- requirement: &70206231773920 !ruby/object:Gem::Requirement
17
+ requirement: &70304481328780 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>='
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: '0'
22
+ version: 1.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70206231773920
25
+ version_requirements: *70304481328780
26
+ - !ruby/object:Gem::Dependency
27
+ name: wasabi
28
+ requirement: &70304481328280 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - =
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *70304481328280
26
37
  - !ruby/object:Gem::Dependency
27
38
  name: savon
28
- requirement: &70206231773180 !ruby/object:Gem::Requirement
39
+ requirement: &70304481327820 !ruby/object:Gem::Requirement
29
40
  none: false
30
41
  requirements:
31
- - - ! '>='
42
+ - - =
32
43
  - !ruby/object:Gem::Version
33
- version: '0'
44
+ version: 0.9.9
34
45
  type: :development
35
46
  prerelease: false
36
- version_requirements: *70206231773180
47
+ version_requirements: *70304481327820
37
48
  - !ruby/object:Gem::Dependency
38
49
  name: rspec-rails
39
- requirement: &70206231772680 !ruby/object:Gem::Requirement
50
+ requirement: &70304481327280 !ruby/object:Gem::Requirement
40
51
  none: false
41
52
  requirements:
42
53
  - - ! '>='
@@ -44,10 +55,10 @@ dependencies:
44
55
  version: '0'
45
56
  type: :development
46
57
  prerelease: false
47
- version_requirements: *70206231772680
58
+ version_requirements: *70304481327280
48
59
  - !ruby/object:Gem::Dependency
49
60
  name: guard
50
- requirement: &70206231772160 !ruby/object:Gem::Requirement
61
+ requirement: &70304481326840 !ruby/object:Gem::Requirement
51
62
  none: false
52
63
  requirements:
53
64
  - - ! '>='
@@ -55,10 +66,10 @@ dependencies:
55
66
  version: '0'
56
67
  type: :development
57
68
  prerelease: false
58
- version_requirements: *70206231772160
69
+ version_requirements: *70304481326840
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: guard-rspec
61
- requirement: &70206231771680 !ruby/object:Gem::Requirement
72
+ requirement: &70304481326440 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ! '>='
@@ -66,10 +77,10 @@ dependencies:
66
77
  version: '0'
67
78
  type: :development
68
79
  prerelease: false
69
- version_requirements: *70206231771680
80
+ version_requirements: *70304481326440
70
81
  - !ruby/object:Gem::Dependency
71
82
  name: rb-inotify
72
- requirement: &70206231771200 !ruby/object:Gem::Requirement
83
+ requirement: &70304481326040 !ruby/object:Gem::Requirement
73
84
  none: false
74
85
  requirements:
75
86
  - - ! '>='
@@ -77,10 +88,10 @@ dependencies:
77
88
  version: '0'
78
89
  type: :development
79
90
  prerelease: false
80
- version_requirements: *70206231771200
91
+ version_requirements: *70304481326040
81
92
  - !ruby/object:Gem::Dependency
82
93
  name: rb-fsevent
83
- requirement: &70206231770680 !ruby/object:Gem::Requirement
94
+ requirement: &70304481325640 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ! '>='
@@ -88,10 +99,10 @@ dependencies:
88
99
  version: '0'
89
100
  type: :development
90
101
  prerelease: false
91
- version_requirements: *70206231770680
102
+ version_requirements: *70304481325640
92
103
  - !ruby/object:Gem::Dependency
93
104
  name: appraisal
94
- requirement: &70206231770140 !ruby/object:Gem::Requirement
105
+ requirement: &70304481325240 !ruby/object:Gem::Requirement
95
106
  none: false
96
107
  requirements:
97
108
  - - ! '>='
@@ -99,10 +110,10 @@ dependencies:
99
110
  version: '0'
100
111
  type: :development
101
112
  prerelease: false
102
- version_requirements: *70206231770140
113
+ version_requirements: *70304481325240
103
114
  - !ruby/object:Gem::Dependency
104
115
  name: tzinfo
105
- requirement: &70206231769520 !ruby/object:Gem::Requirement
116
+ requirement: &70304481324840 !ruby/object:Gem::Requirement
106
117
  none: false
107
118
  requirements:
108
119
  - - ! '>='
@@ -110,10 +121,10 @@ dependencies:
110
121
  version: '0'
111
122
  type: :development
112
123
  prerelease: false
113
- version_requirements: *70206231769520
124
+ version_requirements: *70304481324840
114
125
  - !ruby/object:Gem::Dependency
115
126
  name: pry
116
- requirement: &70206231768740 !ruby/object:Gem::Requirement
127
+ requirement: &70304481340800 !ruby/object:Gem::Requirement
117
128
  none: false
118
129
  requirements:
119
130
  - - ! '>='
@@ -121,7 +132,7 @@ dependencies:
121
132
  version: '0'
122
133
  type: :development
123
134
  prerelease: false
124
- version_requirements: *70206231768740
135
+ version_requirements: *70304481340800
125
136
  description: Dead simple Rails 3 SOAP server library
126
137
  email: boris@roundlake.ru
127
138
  executables: []
@@ -151,6 +162,7 @@ files:
151
162
  - lib/wash_out.rb
152
163
  - lib/wash_out/dispatcher.rb
153
164
  - lib/wash_out/engine.rb
165
+ - lib/wash_out/middleware.rb
154
166
  - lib/wash_out/model.rb
155
167
  - lib/wash_out/param.rb
156
168
  - lib/wash_out/router.rb
@@ -182,13 +194,14 @@ files:
182
194
  - spec/dummy/public/stylesheets/.gitkeep
183
195
  - spec/dummy/script/rails
184
196
  - spec/lib/wash_out/dispatcher_spec.rb
197
+ - spec/lib/wash_out/middleware_spec.rb
185
198
  - spec/lib/wash_out/param_spec.rb
186
199
  - spec/lib/wash_out/type_spec.rb
187
200
  - spec/lib/wash_out_spec.rb
188
201
  - spec/spec_helper.rb
189
202
  - spec/support/httpi-rack.rb
190
203
  - wash_out.gemspec
191
- homepage: http://roundlake.github.com/wash_out/
204
+ homepage: http://github.com/inossidabile/wash_out/
192
205
  licenses: []
193
206
  post_install_message:
194
207
  rdoc_options: []
@@ -213,3 +226,4 @@ signing_key:
213
226
  specification_version: 3
214
227
  summary: Dead simple Rails 3 SOAP server library
215
228
  test_files: []
229
+ has_rdoc: