wash_out 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2
4
+
5
+ * Better camelization: reusable types and methods are now supported [@inossidabile][]
6
+
3
7
  ## 0.4.1
4
8
 
5
9
  * .NET-compliant :integer type WSDL [@inossidabile][]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wash_out (0.4.0)
4
+ wash_out (0.4.1)
5
5
  nori
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
- WashOut
2
- ========
1
+ # WashOut
3
2
 
4
3
  WashOut is a gem that greatly simplifies creation of SOAP service providers.
5
4
 
6
5
  But if you have a chance, please [http://stopsoap.com/](http://stopsoap.com/).
7
6
 
8
- Compatibility
9
- --------------
7
+ ## Compatibility
10
8
 
11
9
  Rails >3.0 only.
12
10
 
@@ -21,15 +19,13 @@ version and give us enough issues and pull-requests to make it work.
21
19
  All dependencies are JRuby-compatible so again it will work well in --1.9 mode but it can fail with
22
20
  fresh releases if you go --1.8.
23
21
 
24
- Installation
25
- ------------
22
+ ## Installation
26
23
 
27
24
  In your Gemfile, add this line:
28
25
 
29
26
  gem 'wash_out'
30
27
 
31
- Usage
32
- -----
28
+ ## Usage
33
29
 
34
30
  A SOAP endpoint in WashOut is simply a Rails controller which includes the module WashOut::SOAP. Each SOAP
35
31
  action corresponds to a certain controller method; this mapping, as well as the argument definition, is defined
@@ -122,8 +118,7 @@ result.to_hash # => {:value=>"123abc"}
122
118
 
123
119
  Take a look at [WashOut sample application](https://github.com/roundlake/wash_out-sample).
124
120
 
125
- Reusable types
126
- ---------
121
+ ## Reusable types
127
122
 
128
123
  Basic inline types definition is fast and furious for the simple cases. You have an option to describe SOAP types
129
124
  inside separate classes for the complex ones. Here's the way to do that:
@@ -149,8 +144,7 @@ To use defined type inside your inline declaration, pass the class instead of ty
149
144
  Note that WashOut extends the `ActiveRecord` so every model you use is already a WashOut::Type and can be used
150
145
  inside your interface declarations.
151
146
 
152
- Configuration
153
- ---------
147
+ ## Configuration
154
148
 
155
149
  Use `config.wash_out...` inside your environment configuration to setup WashOut.
156
150
 
@@ -161,21 +155,27 @@ Available properties are:
161
155
  * **snakecase_input**: Determines if WashOut should modify parameters keys to snakecase. Default is `false`.
162
156
  * **camelize_wsdl**: Determinse if WashOut should camelize types within WSDL and responses. Default is `false`.
163
157
 
164
- Credits
165
- -------
158
+ ### Camelization
159
+
160
+ Note that WSDL camelization will affect method names but only if they were given as a symbol:
161
+
162
+ ```ruby
163
+ soap_action :foo # this will be affected
164
+ soap_action "foo" # this will be passed as is
165
+ ```
166
+
167
+ ## Credits
166
168
 
167
169
  <img src="http://roundlake.ru/assets/logo.png" align="right" />
168
170
 
169
171
  * Boris Staal ([@_inossidabile](http://twitter.com/#!/_inossidabile))
170
172
  * Peter Zotov ([@whitequark](http://twitter.com/#!/whitequark))
171
173
 
172
- Contributors
173
- ------------
174
+ ## Contributors
174
175
 
175
176
  * Björn Nilsson ([@Bjorn-Nilsson](https://github.com/Bjorn-Nilsson))
176
177
  * Tobias Bielohlawek ([@rngtng](https://github.com/rngtng))
177
178
 
178
- LICENSE
179
- -------
179
+ ## LICENSE
180
180
 
181
181
  It is free software, and may be redistributed under the terms of MIT license.
data/lib/wash_out/soap.rb CHANGED
@@ -14,7 +14,17 @@ module WashOut
14
14
  # An optional option :to can be passed to allow for names of SOAP actions
15
15
  # which are not valid Ruby function names.
16
16
  def soap_action(action, options={})
17
- self.soap_actions[action.to_s] = {
17
+ if action.is_a?(Symbol)
18
+ if WashOut::Engine.camelize_wsdl.to_s == 'lower'
19
+ options[:to] ||= action.to_s
20
+ action = action.to_s.camelize(:lower)
21
+ elsif WashOut::Engine.camelize_wsdl
22
+ options[:to] ||= action.to_s
23
+ action = action.to_s.camelize
24
+ end
25
+ end
26
+
27
+ self.soap_actions[action] = {
18
28
  :in => WashOut::Param.parse_def(options[:args]),
19
29
  :out => WashOut::Param.parse_def(options[:return]),
20
30
  :to => options[:to] || action
data/lib/wash_out/type.rb CHANGED
@@ -14,8 +14,14 @@ module WashOut
14
14
  end
15
15
 
16
16
  def self.wash_out_param_name
17
- return name.underscore unless @param_type_name
17
+ @param_type_name ||= name.underscore
18
18
  @param_type_name
19
+
20
+ if WashOut::Engine.camelize_wsdl.to_s == 'lower'
21
+ @param_type_name = @param_type_name.camelize(:lower)
22
+ elsif WashOut::Engine.camelize_wsdl
23
+ @param_type_name = @param_type_name.camelize
24
+ end
19
25
  end
20
26
  end
21
27
  end
@@ -1,3 +1,3 @@
1
1
  module WashOut
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -13,10 +13,10 @@ describe WashOut::Type do
13
13
  map :foo => Abraka1
14
14
  end
15
15
 
16
- Abraka1.wash_out_param_name.should == 'abraka1'
16
+ Abraka1.wash_out_param_name.should == 'Abraka1'
17
17
  Abraka1.wash_out_param_map.should == {:test => :string}
18
18
 
19
- Abraka2.wash_out_param_name.should == 'test'
19
+ Abraka2.wash_out_param_name.should == 'Test'
20
20
  Abraka2.wash_out_param_map.should == {:foo => Abraka1}
21
21
  end
22
22
 
@@ -23,7 +23,7 @@ describe WashOut do
23
23
 
24
24
  it "should generate WSDL" do
25
25
  mock_controller do
26
- soap_action "answer", :args => nil, :return => :int
26
+ soap_action :result, :args => nil, :return => :int
27
27
  def answer
28
28
  render :soap => "42"
29
29
  end
@@ -49,13 +49,13 @@ describe WashOut do
49
49
 
50
50
  # Savon underscores method names so we
51
51
  # get back just what we have at controller
52
- client.wsdl.soap_actions.should == [:answer, :get_area, :rocky]
52
+ client.wsdl.soap_actions.should == [:result, :get_area, :rocky]
53
53
 
54
54
  x = xml[:definitions][:types][:schema][:complex_type].find{|x| x[:'@name'] == 'Center'}[:sequence][:element].find{|x| x[:'@name'] == 'X'}
55
55
  x[:'@min_occurs'].should == "0"
56
56
  x[:'@max_occurs'].should == "unbounded"
57
57
 
58
- xml[:definitions][:binding][:operation].map{|e| e[:'@name']}.should == ['answer', 'getArea', 'rocky']
58
+ xml[:definitions][:binding][:operation].map{|e| e[:'@name']}.should == ['Result', 'getArea', 'rocky']
59
59
 
60
60
  client.wsdl.xml.include?('<xsd:complexType name="Circle1">').should == true
61
61
  end
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.4.1
4
+ version: 0.4.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-16 00:00:00.000000000 Z
13
+ date: 2012-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nori
17
- requirement: &70183612678980 !ruby/object:Gem::Requirement
17
+ requirement: &70248126040800 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70183612678980
25
+ version_requirements: *70248126040800
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec-rails
28
- requirement: &70183612678160 !ruby/object:Gem::Requirement
28
+ requirement: &70248126040380 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70183612678160
36
+ version_requirements: *70248126040380
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: appraisal
39
- requirement: &70183612701640 !ruby/object:Gem::Requirement
39
+ requirement: &70248126039960 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70183612701640
47
+ version_requirements: *70248126039960
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: tzinfo
50
- requirement: &70183612700480 !ruby/object:Gem::Requirement
50
+ requirement: &70248126055900 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70183612700480
58
+ version_requirements: *70248126055900
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: savon
61
- requirement: &70183612699180 !ruby/object:Gem::Requirement
61
+ requirement: &70248126055480 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70183612699180
69
+ version_requirements: *70248126055480
70
70
  description: Dead simple Rails 3 SOAP server library
71
71
  email: boris@roundlake.ru
72
72
  executables: []