wash_out 0.8.1 → 0.8.2
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/wash_out/dispatcher.rb +25 -21
- data/lib/wash_out/version.rb +1 -1
- data/spec/lib/wash_out_spec.rb +14 -2
- metadata +2 -3
- data/Gemfile.lock +0 -109
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 513fa69b67fed06699960bc47f74682cb9900e46
|
4
|
+
data.tar.gz: 22cd7eed3781314cdb0cd1027e2255bb1f1f0c66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3f66255bf9e1cbf9baac534e10ea48831f41818577750edb1e8352f5ccf9aac1dcb644335e2b3e83e61dee13d30cb0f2bfe973b030a7446e4a00edd43d0db1
|
7
|
+
data.tar.gz: 3ba3e4cba92186115b9a4d5923039b058f60f9d83b725eeba0410136d3d129099f5a0b8a4f5bba7018bf16359294ae4b57388d50d6b12d67827392d88ac9f706
|
data/.gitignore
CHANGED
data/lib/wash_out/dispatcher.rb
CHANGED
@@ -104,36 +104,40 @@ module WashOut
|
|
104
104
|
|
105
105
|
inject = lambda {|data, map|
|
106
106
|
result_spec = []
|
107
|
+
return result_spec if data.nil?
|
107
108
|
|
108
109
|
map.each_with_index do |param, i|
|
109
110
|
result_spec[i] = param.flat_copy
|
110
111
|
|
111
|
-
|
112
|
-
|
113
|
-
|
112
|
+
unless data.is_a?(Hash)
|
113
|
+
raise ProgrammerError,
|
114
|
+
"SOAP response used #{data.inspect} (which is #{data.class.name}), " +
|
115
|
+
"in the context where a Hash with key of '#{param.raw_name}' " +
|
116
|
+
"was expected."
|
117
|
+
end
|
114
118
|
|
115
|
-
|
116
|
-
elsif param.struct? && param.multiplied
|
117
|
-
if data.nil?
|
118
|
-
data = {} # when no data is given
|
119
|
-
elsif data.is_a?(Array)
|
120
|
-
raise ProgrammerError,
|
121
|
-
"SOAP response used #{data.inspect} (which is an Array), " +
|
122
|
-
"in the context where a Hash with key of '#{param.raw_name}' " +
|
123
|
-
"was expected."
|
124
|
-
end
|
125
|
-
data[param.raw_name] = [] unless data[param.raw_name].is_a?(Array)
|
126
|
-
result_spec[i].map = data[param.raw_name].map{|e| inject.call(e, param.map)}
|
119
|
+
value = data[param.raw_name]
|
127
120
|
|
128
|
-
|
129
|
-
|
130
|
-
if param.multiplied and val and not val.is_a?(Array)
|
121
|
+
unless value.nil?
|
122
|
+
if param.multiplied && !value.is_a?(Array)
|
131
123
|
raise ProgrammerError,
|
132
|
-
"SOAP response tried to use '#{
|
133
|
-
"(which is of type #{
|
124
|
+
"SOAP response tried to use '#{value.inspect}' " +
|
125
|
+
"(which is of type #{value.class.name}), as the value for " +
|
134
126
|
"'#{param.raw_name}' (which expects an Array)."
|
135
127
|
end
|
136
|
-
|
128
|
+
|
129
|
+
# Inline complex structure {:foo => {bar: ...}}
|
130
|
+
if param.struct? && !param.multiplied
|
131
|
+
result_spec[i].map = inject.call(value, param.map)
|
132
|
+
|
133
|
+
# Inline array of complex structures {:foo => [{bar: ...}]}
|
134
|
+
elsif param.struct? && param.multiplied
|
135
|
+
result_spec[i].map = value.map{|e| inject.call(e, param.map)}
|
136
|
+
|
137
|
+
# Inline scalar {:foo => :string}
|
138
|
+
else
|
139
|
+
result_spec[i].value = value
|
140
|
+
end
|
137
141
|
end
|
138
142
|
end
|
139
143
|
|
data/lib/wash_out/version.rb
CHANGED
data/spec/lib/wash_out_spec.rb
CHANGED
@@ -354,7 +354,7 @@ describe WashOut do
|
|
354
354
|
it "respond with complext definition" do
|
355
355
|
mock_controller do
|
356
356
|
soap_action "rocknroll",
|
357
|
-
:args => nil, :return => { :my_value => [{ :value => :integer}] }
|
357
|
+
:args => nil, :return => { :my_value => [{ :value => :integer }] }
|
358
358
|
def rocknroll
|
359
359
|
render :soap => {}
|
360
360
|
end
|
@@ -366,7 +366,7 @@ describe WashOut do
|
|
366
366
|
it "respond with nested simple definition" do
|
367
367
|
mock_controller do
|
368
368
|
soap_action "rocknroll",
|
369
|
-
:args => nil, :return => { :my_value => { :my_array => [{ :value => :integer}] } }
|
369
|
+
:args => nil, :return => { :my_value => { :my_array => [{ :value => :integer }] } }
|
370
370
|
def rocknroll
|
371
371
|
render :soap => {}
|
372
372
|
end
|
@@ -375,6 +375,18 @@ describe WashOut do
|
|
375
375
|
savon(:rocknroll)[:rocknroll_response][:my_value].
|
376
376
|
should == { :"@xsi:type" => "tns:MyValue" }
|
377
377
|
end
|
378
|
+
|
379
|
+
it "handles incomplete array response" do
|
380
|
+
mock_controller do
|
381
|
+
soap_action "rocknroll",
|
382
|
+
:args => nil, :return => { :my_value => [{ :value => :string }] }
|
383
|
+
def rocknroll
|
384
|
+
render :soap => { :my_value => [nil] }
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
expect{savon(:rocknroll)}.not_to raise_error
|
389
|
+
end
|
378
390
|
end
|
379
391
|
end
|
380
392
|
|
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.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nori
|
@@ -37,7 +37,6 @@ files:
|
|
37
37
|
- Appraisals
|
38
38
|
- CHANGELOG.md
|
39
39
|
- Gemfile
|
40
|
-
- Gemfile.lock
|
41
40
|
- Guardfile
|
42
41
|
- LICENSE
|
43
42
|
- README.md
|
data/Gemfile.lock
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/savonrb/httpi.git
|
3
|
-
revision: 6ca1151f691a6ae8599838b404605aac62ad23c9
|
4
|
-
specs:
|
5
|
-
httpi (2.1.0)
|
6
|
-
rack
|
7
|
-
rubyntlm (~> 0.3.2)
|
8
|
-
|
9
|
-
PATH
|
10
|
-
remote: .
|
11
|
-
specs:
|
12
|
-
wash_out (0.8.1)
|
13
|
-
nori (>= 2.0.0)
|
14
|
-
|
15
|
-
GEM
|
16
|
-
remote: http://rubygems.org/
|
17
|
-
specs:
|
18
|
-
akami (1.2.0)
|
19
|
-
gyoku (>= 0.4.0)
|
20
|
-
nokogiri (>= 1.4.0)
|
21
|
-
appraisal (0.5.2)
|
22
|
-
bundler
|
23
|
-
rake
|
24
|
-
builder (3.2.2)
|
25
|
-
coderay (1.0.9)
|
26
|
-
colored (1.2)
|
27
|
-
diff-lcs (1.1.3)
|
28
|
-
ffi (1.9.0)
|
29
|
-
formatador (0.2.4)
|
30
|
-
guard (1.8.2)
|
31
|
-
formatador (>= 0.2.4)
|
32
|
-
listen (>= 1.0.0)
|
33
|
-
lumberjack (>= 1.0.2)
|
34
|
-
pry (>= 0.9.10)
|
35
|
-
thor (>= 0.14.6)
|
36
|
-
guard-rspec (1.2.1)
|
37
|
-
guard (>= 1.1)
|
38
|
-
gyoku (1.1.0)
|
39
|
-
builder (>= 2.1.2)
|
40
|
-
listen (1.2.2)
|
41
|
-
rb-fsevent (>= 0.9.3)
|
42
|
-
rb-inotify (>= 0.9)
|
43
|
-
rb-kqueue (>= 0.2)
|
44
|
-
lumberjack (1.0.4)
|
45
|
-
method_source (0.8.2)
|
46
|
-
multi_json (1.7.8)
|
47
|
-
nokogiri (1.5.10)
|
48
|
-
nori (2.3.0)
|
49
|
-
pry (0.9.12.2)
|
50
|
-
coderay (~> 1.0.5)
|
51
|
-
method_source (~> 0.8)
|
52
|
-
slop (~> 3.4)
|
53
|
-
rack (1.5.2)
|
54
|
-
rake (10.1.0)
|
55
|
-
rb-fsevent (0.9.3)
|
56
|
-
rb-inotify (0.9.0)
|
57
|
-
ffi (>= 0.5.0)
|
58
|
-
rb-kqueue (0.2.0)
|
59
|
-
ffi (>= 0.5.0)
|
60
|
-
rspec (2.1.0)
|
61
|
-
rspec-core (~> 2.1.0)
|
62
|
-
rspec-expectations (~> 2.1.0)
|
63
|
-
rspec-mocks (~> 2.1.0)
|
64
|
-
rspec-core (2.1.0)
|
65
|
-
rspec-expectations (2.1.0)
|
66
|
-
diff-lcs (~> 1.1.2)
|
67
|
-
rspec-mocks (2.1.0)
|
68
|
-
rspec-rails (2.1.0)
|
69
|
-
rspec (~> 2.1.0)
|
70
|
-
rubyntlm (0.3.3)
|
71
|
-
savon (2.3.0)
|
72
|
-
akami (~> 1.2.0)
|
73
|
-
builder (>= 2.1.2)
|
74
|
-
gyoku (~> 1.1.0)
|
75
|
-
httpi (~> 2.1.0)
|
76
|
-
nokogiri (>= 1.4.0, < 1.6)
|
77
|
-
nori (~> 2.3.0)
|
78
|
-
wasabi (~> 3.2.0)
|
79
|
-
simplecov (0.7.1)
|
80
|
-
multi_json (~> 1.0)
|
81
|
-
simplecov-html (~> 0.7.1)
|
82
|
-
simplecov-html (0.7.1)
|
83
|
-
simplecov-summary (0.0.4)
|
84
|
-
colored
|
85
|
-
simplecov
|
86
|
-
slop (3.4.6)
|
87
|
-
thor (0.18.1)
|
88
|
-
tzinfo (1.0.1)
|
89
|
-
wasabi (3.2.0)
|
90
|
-
httpi (~> 2.0)
|
91
|
-
nokogiri (>= 1.4.0, < 1.6)
|
92
|
-
|
93
|
-
PLATFORMS
|
94
|
-
ruby
|
95
|
-
|
96
|
-
DEPENDENCIES
|
97
|
-
appraisal
|
98
|
-
guard
|
99
|
-
guard-rspec
|
100
|
-
httpi!
|
101
|
-
pry
|
102
|
-
rb-fsevent
|
103
|
-
rspec-rails
|
104
|
-
savon (>= 2.0.0)
|
105
|
-
simplecov
|
106
|
-
simplecov-summary
|
107
|
-
tzinfo
|
108
|
-
wasabi
|
109
|
-
wash_out!
|