wash_out 0.9.0.beta.2 → 0.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b640e8dbbc4f8e47d5b4bf02e02a8eddb87f4022
4
- data.tar.gz: d262ad3bd148080fc799e202ceacafde106413ec
3
+ metadata.gz: fb290b5f2914d741a1cc5ba218d0eab0b87415fc
4
+ data.tar.gz: 336edc510428d18429908b002c22d8c84ab5ec41
5
5
  SHA512:
6
- metadata.gz: 6b50419b1b9249d150c5adc7a85ea40e0ca05cd88efd5596e3ec0a1f94606ade0cf88fa8997daca86c4bfb993e11db2052f0c6421047d19cdd4d1526e04cad4a
7
- data.tar.gz: b8f74d77676cb1e6ae2084444dee8d8034bff01337c3a573727d9fbccd8675f677be2e19308d1faf5eeb80696344a9fea1da75e0ee573bee6e8d6749e2be16c2
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.wsdl.soap_actions # => [:integer_to_string, :concat, :add_circle]
105
+ client.operations # => [:integer_to_string, :concat, :add_circle]
106
106
 
107
- result = client.request(:concat) do
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")
@@ -61,13 +61,14 @@ module WashOut
61
61
  end
62
62
  else
63
63
  operation = case type
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
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
 
@@ -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 = parse_soap_parameters(env)
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!(/^"?(#{namespace}(\/|#)?)?([^"]*)"?$/, '\3')
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 parse_soap_parameters(env)
41
- return env['wash_out.soap_data'] if env['wash_out.soap_data']
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 => ( controller.soap_config.snakecase_input ? lambda { |tag| tag.snakecase.to_sym } : lambda { |tag| tag.to_sym } ))
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'] = if env['rack.input'].respond_to? :string then env['rack.input'].string else env['rack.input'].read end
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?
@@ -2,7 +2,7 @@ module WashOut
2
2
  class Type
3
3
 
4
4
  def self.type_name(value)
5
- @param_type_name = value
5
+ @param_type_name = value.to_s
6
6
  end
7
7
 
8
8
  def self.map(value)
@@ -1,3 +1,3 @@
1
1
  module WashOut
2
- VERSION = "0.9.0.beta.2"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -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.beta.2
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-09-29 00:00:00.000000000 Z
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: 1.3.1
113
+ version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
116
  rubygems_version: 2.0.3