wash_out 0.9.0.beta.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/wash_out/param.rb +8 -7
- data/lib/wash_out/router.rb +20 -12
- data/lib/wash_out/type.rb +1 -1
- data/lib/wash_out/version.rb +1 -1
- data/spec/lib/wash_out_spec.rb +13 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb290b5f2914d741a1cc5ba218d0eab0b87415fc
|
4
|
+
data.tar.gz: 336edc510428d18429908b002c22d8c84ab5ec41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a06e7e53d7b0ed436951a97dbd29cb7592d1ee39743c4bb60c194e347435f6514368744540d9fafd413c906bf0337271ff897ffb7c158280c16dbe30156b32f
|
7
|
+
data.tar.gz: 658031ea5d90bec54848b5ceebdf03b65ecdc3ecf46a6312f5b8adf0e523944332e81ebb5c7e4ce03c47c8cb3e948b7d550cb49170cde363ec9bab896eb3632d
|
data/README.md
CHANGED
@@ -102,11 +102,9 @@ require 'savon'
|
|
102
102
|
|
103
103
|
client = Savon::Client.new(wsdl: "http://localhost:3000/rumbas/wsdl")
|
104
104
|
|
105
|
-
client.
|
105
|
+
client.operations # => [:integer_to_string, :concat, :add_circle]
|
106
106
|
|
107
|
-
result = client.
|
108
|
-
soap.body = { :a => "123", :b => "abc" }
|
109
|
-
end
|
107
|
+
result = client.call(:concat, message: { :a => "123", :b => "abc" })
|
110
108
|
|
111
109
|
# actual wash_out
|
112
110
|
result.to_hash # => {:concat_reponse => {:value=>"123abc"}}
|
@@ -180,3 +178,5 @@ soap_action "foo" # this will be passed as is
|
|
180
178
|
## License
|
181
179
|
|
182
180
|
It is free software, and may be redistributed under the terms of MIT license.
|
181
|
+
|
182
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/inossidabile/wash_out/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
data/lib/wash_out/param.rb
CHANGED
@@ -61,13 +61,14 @@ module WashOut
|
|
61
61
|
end
|
62
62
|
else
|
63
63
|
operation = case type
|
64
|
-
when 'string';
|
65
|
-
when 'integer';
|
66
|
-
when 'double';
|
67
|
-
when 'boolean';
|
68
|
-
when 'date';
|
69
|
-
when 'datetime';
|
70
|
-
when 'time';
|
64
|
+
when 'string'; :to_s
|
65
|
+
when 'integer'; :to_i
|
66
|
+
when 'double'; :to_f
|
67
|
+
when 'boolean'; lambda{|dat| dat === "0" ? false : !!dat}
|
68
|
+
when 'date'; :to_date
|
69
|
+
when 'datetime'; :to_datetime
|
70
|
+
when 'time'; :to_time
|
71
|
+
when 'base64Binary'; lambda{|dat| Base64.decode64(dat)}
|
71
72
|
else raise RuntimeError, "Invalid WashOut simple type: #{type}"
|
72
73
|
end
|
73
74
|
|
data/lib/wash_out/router.rb
CHANGED
@@ -15,10 +15,10 @@ module WashOut
|
|
15
15
|
def parse_soap_action(env)
|
16
16
|
return env['wash_out.soap_action'] if env['wash_out.soap_action']
|
17
17
|
|
18
|
-
soap_action = env['HTTP_SOAPACTION']
|
18
|
+
soap_action = env['HTTP_SOAPACTION'].to_s.gsub(/^"(.*)"$/, '\1')
|
19
19
|
|
20
20
|
if soap_action.blank?
|
21
|
-
soap_action =
|
21
|
+
soap_action = nori.parse(soap_body env)
|
22
22
|
.values_at(:envelope, :Envelope).compact.first
|
23
23
|
.values_at(:body, :Body).compact.first
|
24
24
|
.keys.first.to_s
|
@@ -29,25 +29,33 @@ module WashOut
|
|
29
29
|
|
30
30
|
if controller.soap_config.namespace
|
31
31
|
namespace = Regexp.escape controller.soap_config.namespace.to_s
|
32
|
-
soap_action.gsub!(/^
|
33
|
-
else
|
34
|
-
soap_action = soap_action[1...-1] if soap_action.starts_with?('"')
|
32
|
+
soap_action.gsub!(/^(#{namespace}(\/|#)?)?([^"]*)$/, '\3')
|
35
33
|
end
|
36
34
|
|
37
35
|
env['wash_out.soap_action'] = soap_action
|
38
36
|
end
|
39
37
|
|
40
|
-
def
|
41
|
-
|
42
|
-
|
43
|
-
nori_parser = Nori.new(
|
38
|
+
def nori(snakecase=false)
|
39
|
+
Nori.new(
|
44
40
|
:parser => controller.soap_config.parser,
|
45
41
|
:strip_namespaces => true,
|
46
42
|
:advanced_typecasting => true,
|
47
|
-
:convert_tags_to => (
|
43
|
+
:convert_tags_to => (
|
44
|
+
snakecase ? lambda { |tag| tag.snakecase.to_sym }
|
45
|
+
: lambda { |tag| tag.to_sym }
|
46
|
+
)
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def soap_body(env)
|
51
|
+
env['rack.input'].respond_to?(:string) ? env['rack.input'].string
|
52
|
+
: env['rack.input'].read
|
53
|
+
end
|
54
|
+
|
55
|
+
def parse_soap_parameters(env)
|
56
|
+
return env['wash_out.soap_data'] if env['wash_out.soap_data']
|
48
57
|
|
49
|
-
env['wash_out.soap_data'] =
|
50
|
-
env['wash_out.soap_data'] = nori_parser.parse(env['wash_out.soap_data'])
|
58
|
+
env['wash_out.soap_data'] = nori(controller.soap_config.snakecase_input).parse(soap_body env)
|
51
59
|
references = WashOut::Dispatcher.deep_select(env['wash_out.soap_data']){|k,v| v.is_a?(Hash) && v.has_key?(:@id)}
|
52
60
|
|
53
61
|
unless references.blank?
|
data/lib/wash_out/type.rb
CHANGED
data/lib/wash_out/version.rb
CHANGED
data/spec/lib/wash_out_spec.rb
CHANGED
@@ -451,6 +451,19 @@ describe WashOut do
|
|
451
451
|
savon(:date, :value => '2000-12-30')
|
452
452
|
lambda { savon(:date) }.should_not raise_exception
|
453
453
|
end
|
454
|
+
|
455
|
+
it "recognize base64Binary" do
|
456
|
+
mock_controller do
|
457
|
+
soap_action "base64", :args => :base64Binary, :return => :nil
|
458
|
+
def base64
|
459
|
+
params[:value].should == 'test' unless params[:value].blank?
|
460
|
+
render :soap => nil
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
savon(:base64, :value => Base64.encode64('test'))
|
465
|
+
lambda { savon(:base64) }.should_not raise_exception
|
466
|
+
end
|
454
467
|
end
|
455
468
|
|
456
469
|
context "errors" do
|
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.9.0
|
4
|
+
version: 0.9.0
|
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-
|
12
|
+
date: 2013-11-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nori
|
@@ -108,9 +108,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
|
-
- - '
|
111
|
+
- - '>='
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
113
|
+
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
116
|
rubygems_version: 2.0.3
|