washout_builder 1.7.5 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/Appraisals +8 -2
- data/Gemfile +0 -18
- data/README.md +21 -0
- data/app/helpers/washout_builder_complex_type_helper.rb +4 -2
- data/app/helpers/washout_builder_method_arguments_helper.rb +4 -2
- data/app/helpers/washout_builder_method_list_helper.rb +4 -2
- data/app/helpers/washout_builder_method_return_type_helper.rb +5 -3
- data/app/helpers/washout_builder_shared_helper.rb +29 -0
- data/gemfiles/rails_6.1.3.gemfile +8 -0
- data/install-travis-bundler.sh +2 -2
- data/lib/washout_builder.rb +0 -1
- data/lib/washout_builder/document/complex_type.rb +4 -23
- data/lib/washout_builder/document/shared_complex_type.rb +5 -1
- data/lib/washout_builder/soap.rb +2 -2
- data/lib/washout_builder/version.rb +2 -2
- data/spec/lib/washout_builder/document/complex_type_spec.rb +30 -30
- data/spec/spec_helper.rb +26 -1
- data/spec/support/complex_types/test_type.rb +1 -2
- data/washout_builder.gemspec +19 -0
- metadata +287 -4
- data/lib/washout_builder/param.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07cbf72181269afe7c81be817b82027fc0353f4be0174b926b329c9963712d20
|
4
|
+
data.tar.gz: 6431a14a4a5e4fedc0c3682dbeec724678eaec360025eff7292a5c133d2cc421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0220855ff5d6656482d2a23db14e6150330508d9d55ca8cdd89bd66605ae783afcf2c0416f188eeb4f58b0dc8ec69c5d2d20326d1cec0bad3cba6d1aac7dbd02'
|
7
|
+
data.tar.gz: 373c906bb927c4dc0e4a5610f811dccba8ff39adfa3dc5fa1e919dcdca23861d35ab605eca7d0b1b7457dfcd3fb3dc840b9bd55e078f0943323a61343fcab7a8
|
data/.travis.yml
CHANGED
@@ -58,7 +58,7 @@ matrix:
|
|
58
58
|
- rvm: 2.6.5
|
59
59
|
gemfile: gemfiles/rails_4.1.1.gemfile
|
60
60
|
- rvm: 2.6.5
|
61
|
-
|
61
|
+
gemfile: gemfiles/rails_4.2.0.gemfile
|
62
62
|
rvm:
|
63
63
|
- 2.2.5
|
64
64
|
- 2.3.1
|
@@ -67,5 +67,7 @@ rvm:
|
|
67
67
|
- 2.4.7
|
68
68
|
- 2.5.6
|
69
69
|
- 2.6.5
|
70
|
+
- 2.7.1
|
71
|
+
- 3.0.0
|
70
72
|
notifications:
|
71
73
|
email: false
|
data/Appraisals
CHANGED
@@ -17,7 +17,7 @@ if RUBY_VERSION <= "2.4.0"
|
|
17
17
|
gem 'actionpack' , '4.2.7.1'
|
18
18
|
end
|
19
19
|
end
|
20
|
-
if
|
20
|
+
if RUBY_VERSION >= '2.2.0' && RUBY_VERSION < '3.0.0' && ENV['BUNDLER_VERSION'].to_s <= '2.0'
|
21
21
|
appraise "rails-5.0.0" do
|
22
22
|
gem "rails", "5.0.0"
|
23
23
|
end
|
@@ -40,7 +40,7 @@ if RUBY_VERSION >= '2.2.0' && ENV['BUNDLER_VERSION'].to_s <= '2.0'
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
if
|
43
|
+
if RUBY_VERSION >= '2.2.0' && RUBY_VERSION < '3.0.0' && ENV['BUNDLER_VERSION'].to_s >= '2.0'
|
44
44
|
appraise "rails-5.2.0" do
|
45
45
|
gem "rails", "5.2.0"
|
46
46
|
end
|
@@ -57,3 +57,9 @@ if RUBY_VERSION >= '2.2.0' && ENV['BUNDLER_VERSION'].to_s >= '2.0'
|
|
57
57
|
gem "rails", "6.0.1"
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
if RUBY_VERSION >= '3.0.0' && ENV['BUNDLER_VERSION'].to_s >= '2.0'
|
62
|
+
appraise "rails-6.1.3" do
|
63
|
+
gem "rails", "6.1.3"
|
64
|
+
end
|
65
|
+
end
|
data/Gemfile
CHANGED
@@ -3,21 +3,3 @@ source 'http://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
gem 'wash_out', git: 'https://github.com/inossidabile/wash_out.git'
|
6
|
-
|
7
|
-
gem 'wasabi'
|
8
|
-
gem 'savon', '>= 2.11'
|
9
|
-
gem 'httpi', '>= 2.4'
|
10
|
-
gem 'nokogiri', '>= 1.7'
|
11
|
-
|
12
|
-
gem 'rspec-rails','4.0.0.beta3'
|
13
|
-
gem 'appraisal', '>= 2.1'
|
14
|
-
gem 'simplecov', '>= 0.12'
|
15
|
-
gem 'simplecov-summary', '>= 0.0.5'
|
16
|
-
gem 'mocha', '>= 1.2'
|
17
|
-
gem 'coveralls', '>= 0.8'
|
18
|
-
|
19
|
-
gem "yard", '>= 0.9.20'
|
20
|
-
gem 'yard-rspec', '>= 0.1'
|
21
|
-
gem 'redcarpet', '>= 3.4'
|
22
|
-
gem 'github-markup', '>= 1.4'
|
23
|
-
gem 'inch', '>= 0.7'
|
data/README.md
CHANGED
@@ -10,6 +10,27 @@ WashOutBuilder is a Soap Service Documentation generator (extends [WashOut](http
|
|
10
10
|
|
11
11
|
The way [WashOut](https://github.com/inossidabile/wash_out) is used is not modified, it just extends its functionality by generating html documentation to your services that you write
|
12
12
|
|
13
|
+
NEW Improvements in version 2.0.1
|
14
|
+
---------------------------------
|
15
|
+
- Fix issue when trying to re-use same complex type (with same structure) multiple times inside same controller
|
16
|
+
|
17
|
+
NEW Improvements in version 2.0.0
|
18
|
+
---------------------------------
|
19
|
+
|
20
|
+
This release tries to fix some major bugs and introduces backward incompatible changes.
|
21
|
+
- The complex type list will contain now exactly same types used when doing an actual SOAP request
|
22
|
+
- Same for when listing the soap actions ( the return type and parameters ).
|
23
|
+
|
24
|
+
Initially the way the complex types were shown on the page was not correct, because it was not reflecting
|
25
|
+
the actual way the SOAP action receives its arguments when doing an actual SOAP request to that controller
|
26
|
+
|
27
|
+
The main issue was not handling correctly the classes that are inheriting from WashOut::Type.
|
28
|
+
|
29
|
+
This release tries to fix those issues.
|
30
|
+
|
31
|
+
Note: Only internal methods have been changed. The configuration has not changed.
|
32
|
+
So in order to upgrade to this new version, just update the version in your Gemfile/gemspec file
|
33
|
+
|
13
34
|
NEW Improvements in version 1.5.1
|
14
35
|
---------------------------------
|
15
36
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# module that is used for constructing complex types in HTML-Documentation
|
2
2
|
module WashoutBuilderComplexTypeHelper
|
3
|
+
include WashoutBuilderSharedHelper
|
3
4
|
# this method is for printing the attributes of a complex type
|
4
5
|
# if the attributes are primitives this will show the attributes with blue color
|
5
6
|
# otherwise will call another method for printing the complex attribute
|
@@ -49,8 +50,9 @@ module WashoutBuilderComplexTypeHelper
|
|
49
50
|
def create_complex_element_type_html(pre, element, element_description)
|
50
51
|
complex_class = element.find_complex_class_name
|
51
52
|
return if complex_class.nil?
|
52
|
-
|
53
|
-
|
53
|
+
real_class = find_correct_complex_type(complex_class)
|
54
|
+
complex_class_content = element.multiplied ? "Array of #{real_class}" : "#{real_class}"
|
55
|
+
pre << "<a href='##{real_class}'><span class='lightBlue'>#{complex_class_content}</span></a> <span class='bold'>#{element.name}</span>"
|
54
56
|
pre << " <span>#{html_safe(element_description)}</span>" unless element_description.blank?
|
55
57
|
pre
|
56
58
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# helper that is used to show the arguments of a method with their types in HTML documentation
|
2
2
|
module WashoutBuilderMethodArgumentsHelper
|
3
|
+
include WashoutBuilderSharedHelper
|
3
4
|
# displays the parameter of a method as argument and determines if the parameter is basic type or complex type
|
4
5
|
#
|
5
6
|
# @see WashoutBuilder::Document::ComplexType#find_complex_class_name
|
@@ -37,8 +38,9 @@ module WashoutBuilderMethodArgumentsHelper
|
|
37
38
|
# @api public
|
38
39
|
def create_method_argument_complex_element(pre, param, use_spacer, spacer, complex_class)
|
39
40
|
return if complex_class.nil?
|
40
|
-
|
41
|
-
|
41
|
+
real_class = find_correct_complex_type(complex_class)
|
42
|
+
argument_content = param.multiplied ? "Array of #{real_class}" : "#{real_class}"
|
43
|
+
pre << "#{use_spacer ? spacer : ''}<a href='##{real_class}'><span class='lightBlue'>#{argument_content}</span></a> <span class='bold'>#{param.name}</span>"
|
42
44
|
end
|
43
45
|
|
44
46
|
# this method will check if the current index of the argument is not last, will insert a comma then a break if the argument is followed by other arguments,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# helper that is used to list the method's return tyep as a LI element in HTML documentation
|
2
2
|
module WashoutBuilderMethodListHelper
|
3
|
+
include WashoutBuilderSharedHelper
|
3
4
|
# this method will create the return type of the method and check if the type is basic or complex type or array of types
|
4
5
|
#
|
5
6
|
# @param [Builder::XmlMarkup] xml the markup builder that is used to insert HTML line breaks or span elements
|
@@ -10,9 +11,10 @@ module WashoutBuilderMethodListHelper
|
|
10
11
|
#
|
11
12
|
# @api public
|
12
13
|
def create_return_complex_type_list_html(xml, complex_class, builder_out)
|
13
|
-
|
14
|
+
real_class = find_correct_complex_type(complex_class)
|
15
|
+
return_content = builder_out[0].multiplied ? "Array of #{real_class}" : "#{real_class}"
|
14
16
|
xml.span('class' => 'pre') do
|
15
|
-
xml.a('href' => "##{
|
17
|
+
xml.a('href' => "##{real_class}") do |inner_xml|
|
16
18
|
inner_xml.span('class' => 'lightBlue') do |y|
|
17
19
|
y << "#{return_content}"
|
18
20
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# helper that is used to create the return types of methods in HTML documentation
|
2
2
|
module WashoutBuilderMethodReturnTypeHelper
|
3
|
+
include WashoutBuilderSharedHelper
|
3
4
|
# this method will print the return type next to the method name
|
4
5
|
# @see WashoutBuilder::Document::ComplexType#find_complex_class_name
|
5
6
|
# @see WashoutBuilder::Type::BASIC_TYPES
|
@@ -37,11 +38,12 @@ module WashoutBuilderMethodReturnTypeHelper
|
|
37
38
|
# @api public
|
38
39
|
def html_public_method_complex_type(pre, output, complex_class)
|
39
40
|
return if complex_class.nil?
|
41
|
+
real_class = find_correct_complex_type(complex_class)
|
40
42
|
if output[0].multiplied
|
41
|
-
complex_return_type = "Array of #{
|
43
|
+
complex_return_type = "Array of #{real_class}"
|
42
44
|
else
|
43
|
-
complex_return_type = "#{
|
45
|
+
complex_return_type = "#{real_class}"
|
44
46
|
end
|
45
|
-
pre << "<a href='##{
|
47
|
+
pre << "<a href='##{real_class}'><span class='lightBlue'>#{complex_return_type}</span></a>"
|
46
48
|
end
|
47
49
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module WashoutBuilderSharedHelper
|
2
|
+
# When displaying a complex type that inherits from WashOut::Type
|
3
|
+
# we must use its descendant name to properly show the correct Type
|
4
|
+
# that can we used to make the actual request to the action
|
5
|
+
#
|
6
|
+
# @param [Class, String] complex_class the name of the complex type either as a string or a class
|
7
|
+
# @return [Class, String]
|
8
|
+
# @api public
|
9
|
+
def find_correct_complex_type(complex_class)
|
10
|
+
real_class = find_class_from_string(complex_class)
|
11
|
+
if real_class.present? && real_class.ancestors.include?( WashoutBuilder::Type.base_type_class)
|
12
|
+
descendant = WashoutBuilder::Type.base_param_class.parse_def(config, real_class.wash_out_param_map)[0]
|
13
|
+
descendant.find_complex_class_name
|
14
|
+
else
|
15
|
+
complex_class
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Tries to constantize a string or a class to return the class
|
20
|
+
#
|
21
|
+
# @param [String] complex_class A string that contains the name of a class
|
22
|
+
# @return [Class, nil] returns the class if it is classes_defined otherwise nil
|
23
|
+
# @api public
|
24
|
+
def find_class_from_string(complex_class)
|
25
|
+
complex_class.is_a?(Class) ? complex_class : complex_class.constantize
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
data/install-travis-bundler.sh
CHANGED
@@ -11,8 +11,8 @@ echo "Trying to compare rails ${rails_version:="1"} with 5.2"
|
|
11
11
|
if (( $(echo "${rails_version%.*} >= 5.2" |bc -l) )); then
|
12
12
|
echo "Installing Bundler v2"
|
13
13
|
gem uninstall -v '< 2.0' -i "$(rvm gemdir)"@global -ax bundler --force || true
|
14
|
-
gem install bundler -v '2.
|
15
|
-
export MY_BUNDLER_VERSION="_2.
|
14
|
+
gem install bundler -v '2.2.11'
|
15
|
+
export MY_BUNDLER_VERSION="_2.2.11_"
|
16
16
|
else
|
17
17
|
echo "Installing Bundler v1"
|
18
18
|
gem uninstall -v '>= 2' -i "$(rvm gemdir)"@global -ax bundler --force || true
|
data/lib/washout_builder.rb
CHANGED
@@ -30,7 +30,7 @@ module WashoutBuilder
|
|
30
30
|
# @raise [RuntimeError] Raises a runtime error if is detected a duplicate use of the complex type
|
31
31
|
# @api public
|
32
32
|
def check_duplicate_complex_class(classes_defined, complex_class)
|
33
|
-
complex_obj_found = classes_defined.find { |hash| hash[:class] == complex_class }
|
33
|
+
complex_obj_found = classes_defined.find { |hash| hash if hash[:class] == complex_class && hash[:obj].find_param_structure.keys != self.find_param_structure.keys }
|
34
34
|
raise "Duplicate use of `#{basic_type}` type name. Consider using classified types." if !complex_obj_found.nil? && struct? && !classified?
|
35
35
|
end
|
36
36
|
|
@@ -71,25 +71,6 @@ module WashoutBuilder
|
|
71
71
|
self.map = map.delete_if { |element| keys.include?(element.name) }
|
72
72
|
end
|
73
73
|
|
74
|
-
# Dirty hack to fix the first washout param type.
|
75
|
-
# This only applies if the first complex type is inheriting WashOutType
|
76
|
-
# its name should be set to its descendant and the map of the current object will be set to its descendant
|
77
|
-
# @see WashOut::Param#parse_builder_def
|
78
|
-
#
|
79
|
-
# @param [WashOut::SoapConfig] config an object that holds the soap configuration
|
80
|
-
# @param [Class, String] complex_class the name of the complex type either as a string or a class
|
81
|
-
# @return [void]
|
82
|
-
# @api public
|
83
|
-
def fix_descendant_wash_out_type(config, complex_class)
|
84
|
-
param_class = find_class_from_string(complex_class)
|
85
|
-
base_param_class = WashoutBuilder::Type.base_param_class
|
86
|
-
base_type_class = WashoutBuilder::Type.base_type_class
|
87
|
-
return if base_param_class.blank? || base_type_class.blank?
|
88
|
-
return unless param_class.present? && param_class.ancestors.include?(base_type_class) && map[0].present?
|
89
|
-
descendant = base_param_class.parse_builder_def(config, param_class.wash_out_param_map)[0]
|
90
|
-
self.name = descendant.name
|
91
|
-
self.map = descendant.map
|
92
|
-
end
|
93
74
|
|
94
75
|
# Description of method
|
95
76
|
#
|
@@ -172,8 +153,8 @@ module WashoutBuilder
|
|
172
153
|
def get_nested_complex_types(config, classes_defined)
|
173
154
|
classes_defined = [] if classes_defined.blank?
|
174
155
|
complex_class = find_complex_class_name(classes_defined)
|
175
|
-
|
176
|
-
|
156
|
+
real_class = find_class_from_string(complex_class)
|
157
|
+
if complex_class.present? && (real_class.blank? || (real_class.present? && !real_class.ancestors.include?( WashoutBuilder::Type.base_type_class)))
|
177
158
|
classes_defined << complex_type_hash(complex_class, self, complex_type_ancestors(config, complex_class, classes_defined))
|
178
159
|
end
|
179
160
|
classes_defined = complex_type_descendants(config, classes_defined)
|
@@ -216,7 +197,7 @@ module WashoutBuilder
|
|
216
197
|
# @param [Array<Hash>] classes_defined An Array with all the complex types that have been detected so far
|
217
198
|
# @return [Array<Class>] An Array of classes from which the class that is sent as parameter inherits from
|
218
199
|
# @api public
|
219
|
-
def
|
200
|
+
def get_class_ancestors(config, class_name, classes_defined)
|
220
201
|
ancestors = get_ancestors(class_name)
|
221
202
|
return if ancestors.blank?
|
222
203
|
base_param_class = WashoutBuilder::Type.base_param_class
|
@@ -8,7 +8,11 @@ module WashoutBuilder
|
|
8
8
|
# @param [Array<Class>] array The array of classes that should be fitered from the ancestors if they are present
|
9
9
|
# @return [Array<Class>] The classes from which the class given as first argument inherits from but filtering the classes passed as second argument
|
10
10
|
def get_complex_type_ancestors(class_name, array)
|
11
|
-
(class_name.ancestors - class_name.included_modules).delete_if
|
11
|
+
(class_name.ancestors - class_name.included_modules).delete_if do |x|
|
12
|
+
x.to_s.downcase == class_name.to_s.downcase ||
|
13
|
+
array.include?(x.to_s) ||
|
14
|
+
(x.respond_to?(:abstract_class) && x.abstract_class)
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/washout_builder/soap.rb
CHANGED
@@ -37,8 +37,8 @@ module WashoutBuilder
|
|
37
37
|
current_action = soap_actions[action]
|
38
38
|
base_param_class = WashoutBuilder::Type.base_param_class
|
39
39
|
return if base_param_class.blank?
|
40
|
-
current_action[:builder_in] = base_param_class.
|
41
|
-
current_action[:builder_out] = base_param_class.
|
40
|
+
current_action[:builder_in] = base_param_class.parse_def(soap_config, options[:args])
|
41
|
+
current_action[:builder_out] = base_param_class.parse_def(soap_config, options[:return])
|
42
42
|
current_action[:args_description] = options[:args_description].present? && options[:args_description].is_a?(Hash) ? options[:args_description].stringify_keys : {}
|
43
43
|
current_action
|
44
44
|
end
|
@@ -8,9 +8,9 @@ module WashoutBuilder
|
|
8
8
|
# the module that is used to generate the gem version
|
9
9
|
module VERSION
|
10
10
|
# the major version of the gem
|
11
|
-
MAJOR =
|
11
|
+
MAJOR = 2
|
12
12
|
# the minor version of the gem
|
13
|
-
MINOR =
|
13
|
+
MINOR = 0
|
14
14
|
# the tiny version of the gem
|
15
15
|
TINY = 5
|
16
16
|
# if the version should be a prerelease
|
@@ -14,29 +14,29 @@ describe WashoutBuilder::Document::ComplexType do
|
|
14
14
|
let(:namespaced_object) { get_wash_out_param(Api::TestType) }
|
15
15
|
|
16
16
|
it 'returns the complex class name' do
|
17
|
-
expect(subject.find_complex_class_name).to eq('
|
17
|
+
expect(subject.find_complex_class_name).to eq('Project')
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'returns the complex class with namespace' do
|
21
|
-
expect(namespaced_object.find_complex_class_name).to eq('
|
21
|
+
expect(namespaced_object.find_complex_class_name).to eq('Project')
|
22
22
|
end
|
23
23
|
|
24
|
-
it '
|
24
|
+
it 'does not return error if classname already detected (only used for hashes) and same structure' do
|
25
25
|
subject.stubs(:classified?).returns(false)
|
26
26
|
subject.stubs(:basic_type).returns('ProjectType')
|
27
|
-
|
28
|
-
expect { subject.find_complex_class_name(
|
27
|
+
classes_defined = [{ class: 'ProjectType', obj: get_wash_out_param(ProjectType), ancestors: [] }]
|
28
|
+
expect { subject.find_complex_class_name(classes_defined) }.to_not raise_error(RuntimeError, 'Duplicate use of `ProjectType` type name. Consider using classified types.')
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'returns
|
32
|
-
|
31
|
+
it 'returns error if classname already detected (only used for hashes)' do
|
32
|
+
subject.stubs(:classified?).returns(false)
|
33
|
+
subject.stubs(:basic_type).returns('ProjectType')
|
34
|
+
classes_defined = [{ class: 'ProjectType', obj: get_wash_out_param(Api::TestType), ancestors: [] }]
|
35
|
+
expect { subject.find_complex_class_name(classes_defined) }.to raise_error(RuntimeError, 'Duplicate use of `ProjectType` type name. Consider using classified types.')
|
33
36
|
end
|
34
37
|
|
35
|
-
it '
|
36
|
-
|
37
|
-
subject.fix_descendant_wash_out_type(soap_config, ProjectType)
|
38
|
-
expect(subject.name).to eq(descendant.name)
|
39
|
-
expect(subject.map[0].find_param_structure).to eq(descendant.map[0].find_param_structure)
|
38
|
+
it 'returns the param structure' do
|
39
|
+
expect(subject.find_param_structure).to eq("description"=>"string", "name"=>"string", "users"=>"struct")
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'same as ancestor' do
|
@@ -75,18 +75,18 @@ describe WashoutBuilder::Document::ComplexType do
|
|
75
75
|
|
76
76
|
describe '#complex_type_descendants' do
|
77
77
|
it 'returns empty array if not struct?' do
|
78
|
-
|
78
|
+
classes_defined = []
|
79
79
|
subject.stubs(:struct?).returns(false)
|
80
|
-
expect(subject.complex_type_descendants(soap_config,
|
80
|
+
expect(subject.complex_type_descendants(soap_config, classes_defined)).to eq(classes_defined)
|
81
81
|
end
|
82
82
|
|
83
83
|
it 'returns the descendants if struct?' do
|
84
|
-
|
84
|
+
classes_defined = []
|
85
85
|
subject.map.each do |obj|
|
86
|
-
obj.expects(:get_nested_complex_types).with(soap_config,
|
86
|
+
obj.expects(:get_nested_complex_types).with(soap_config, classes_defined).returns([obj.name])
|
87
87
|
end
|
88
88
|
subject.stubs(:struct?).returns(true)
|
89
|
-
expect(subject.complex_type_descendants(soap_config,
|
89
|
+
expect(subject.complex_type_descendants(soap_config, classes_defined)).to eq(subject.map.map(&:name))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -97,21 +97,20 @@ describe WashoutBuilder::Document::ComplexType do
|
|
97
97
|
let(:expected) { [complex_type_hash] }
|
98
98
|
|
99
99
|
it 'returns the complex class ancestors' do
|
100
|
-
|
101
|
-
subject.expects(:find_complex_class_name).with(
|
102
|
-
subject.expects(:
|
103
|
-
subject.expects(:complex_type_ancestors).with(soap_config, complex_class,
|
100
|
+
classes_defined = []
|
101
|
+
subject.expects(:find_complex_class_name).with(classes_defined).returns(complex_class)
|
102
|
+
subject.expects(:find_class_from_string).with(complex_class).returns(nil)
|
103
|
+
subject.expects(:complex_type_ancestors).with(soap_config, complex_class, classes_defined).returns(ancestors)
|
104
104
|
subject.expects(:complex_type_hash).with(complex_class, subject, ancestors).returns(complex_type_hash)
|
105
105
|
subject.expects(:complex_type_descendants).with(soap_config, [complex_type_hash]).returns(expected)
|
106
|
-
expect(subject.get_nested_complex_types(soap_config,
|
106
|
+
expect(subject.get_nested_complex_types(soap_config, classes_defined)).to eq(expected)
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'returns the the descendants' do
|
110
|
-
|
110
|
+
classes_defined = nil
|
111
111
|
subject.expects(:find_complex_class_name).with([]).returns(nil)
|
112
|
-
subject.expects(:fix_descendant_wash_out_type).with(soap_config, nil).returns(true)
|
113
112
|
subject.expects(:complex_type_descendants).with(soap_config, []).returns(expected)
|
114
|
-
expect(subject.get_nested_complex_types(soap_config,
|
113
|
+
expect(subject.get_nested_complex_types(soap_config, classes_defined)).to eq(expected)
|
115
114
|
end
|
116
115
|
end
|
117
116
|
|
@@ -135,7 +134,7 @@ describe WashoutBuilder::Document::ComplexType do
|
|
135
134
|
|
136
135
|
describe '#get_class_ancestors' do
|
137
136
|
let(:class_name) { 'ProjectType' }
|
138
|
-
let(:
|
137
|
+
let(:classes_defined) { [] }
|
139
138
|
let(:ancestors) { ['SomeInexistentClass'] }
|
140
139
|
let(:ancestor_structure) { { ancestors[0].to_s.downcase => 'bla' } }
|
141
140
|
let(:top_ancestors) {}
|
@@ -143,7 +142,7 @@ describe WashoutBuilder::Document::ComplexType do
|
|
143
142
|
|
144
143
|
it 'returns nil if no ancestors' do
|
145
144
|
subject.expects(:get_ancestors).with(class_name).returns(nil)
|
146
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
145
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq(nil)
|
147
146
|
end
|
148
147
|
|
149
148
|
it 'returns the ancestors and the top ones' do
|
@@ -153,15 +152,16 @@ describe WashoutBuilder::Document::ComplexType do
|
|
153
152
|
WashOut::Param.stubs(:parse_def).returns([namespaced_object])
|
154
153
|
subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(false)
|
155
154
|
subject.expects(:complex_type_hash).returns(complex_type_hash)
|
156
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
155
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq([complex_type_hash])
|
157
156
|
end
|
158
157
|
|
159
158
|
it 'returns nil if same structure as ancestor' do
|
159
|
+
namespaced_object
|
160
160
|
subject.expects(:get_ancestors).with(class_name).returns(ancestors)
|
161
161
|
subject.expects(:ancestor_structure).with(ancestors).returns(ancestor_structure)
|
162
|
-
WashOut::Param.stubs(:parse_def).returns([namespaced_object])
|
162
|
+
WashOut::Param.stubs(:parse_def).with(soap_config, ancestor_structure).returns([namespaced_object])
|
163
163
|
subject.expects(:same_structure_as_ancestor?).with(namespaced_object).returns(true)
|
164
|
-
expect(subject.get_class_ancestors(soap_config, class_name,
|
164
|
+
expect(subject.get_class_ancestors(soap_config, class_name, classes_defined)).to eq(nil)
|
165
165
|
end
|
166
166
|
end
|
167
167
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -102,7 +102,7 @@ def get_wash_out_param(class_or_struct, soap_config = OpenStruct.new(
|
|
102
102
|
camelize_wsdl: false,
|
103
103
|
namespace: '/api/wsdl'
|
104
104
|
))
|
105
|
-
WashOut::Param.
|
105
|
+
WashOut::Param.parse_def(soap_config, class_or_struct)[0]
|
106
106
|
end
|
107
107
|
|
108
108
|
class Hash
|
@@ -154,3 +154,28 @@ unless defined?(silence_stream) # Rails 5
|
|
154
154
|
old_stream.close
|
155
155
|
end
|
156
156
|
end
|
157
|
+
|
158
|
+
# TODO: remove this when wasabi will update their code
|
159
|
+
require 'uri'
|
160
|
+
if !defined?(::URI.unescape)
|
161
|
+
::URI.class_eval do
|
162
|
+
# this was removed in this commit
|
163
|
+
# https://github.com/ruby/uri/commit/61c6a47ebf1f2726b60a2bbd70964d64e14b1f98
|
164
|
+
# so we are adding it back because we need to be compatible with wasabi on ruby 3.0.0
|
165
|
+
module UriEscapeBackport
|
166
|
+
|
167
|
+
def escape(*arg)
|
168
|
+
::URI::DEFAULT_PARSER.escape(*arg)
|
169
|
+
end
|
170
|
+
|
171
|
+
alias encode escape
|
172
|
+
|
173
|
+
def unescape(*arg)
|
174
|
+
::URI::DEFAULT_PARSER.unescape(*arg)
|
175
|
+
end
|
176
|
+
|
177
|
+
alias decode unescape
|
178
|
+
end
|
179
|
+
extend UriEscapeBackport
|
180
|
+
end
|
181
|
+
end
|
data/washout_builder.gemspec
CHANGED
@@ -21,4 +21,23 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_runtime_dependency 'wash_out', '>= 0.9.1', '>= 0.9.1'
|
23
23
|
s.add_runtime_dependency 'activesupport', '>= 4.0', '>= 4.0'
|
24
|
+
|
25
|
+
# wasabi >= 3.6.0 does not work well with savon
|
26
|
+
s.add_development_dependency 'wasabi', '< 3.6.0'
|
27
|
+
s.add_development_dependency 'savon', '~> 2.11', '>= 2.11'
|
28
|
+
s.add_development_dependency 'httpi', '~> 2.4', '>= 2.4'
|
29
|
+
s.add_development_dependency 'nokogiri', '~> 1.7', '>= 1.7'
|
30
|
+
|
31
|
+
s.add_development_dependency 'rspec-rails','4.0.2'
|
32
|
+
s.add_development_dependency 'appraisal', '~> 2.1', '>= 2.1'
|
33
|
+
s.add_development_dependency 'simplecov', '~> 0.12', '>= 0.12'
|
34
|
+
s.add_development_dependency 'simplecov-summary', '~> 0.0.5', '>= 0.0.5'
|
35
|
+
s.add_development_dependency 'mocha','~> 1.2', '>= 1.2'
|
36
|
+
s.add_development_dependency 'coveralls','~> 0.8', '>= 0.8'
|
37
|
+
|
38
|
+
s.add_development_dependency "yard", '~> 0.9', '>= 0.9.20'
|
39
|
+
s.add_development_dependency 'yard-rspec', '~> 0.1', '>= 0.1'
|
40
|
+
s.add_development_dependency 'redcarpet', '~> 3.4', '>= 3.4'
|
41
|
+
s.add_development_dependency 'github-markup', '~> 1.4', '>= 1.4'
|
42
|
+
s.add_development_dependency 'inch', '~> 0.7'
|
24
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: washout_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wash_out
|
@@ -38,6 +38,288 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: wasabi
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.6.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.6.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: savon
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.11'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '2.11'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '2.11'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.11'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: httpi
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.4'
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '2.4'
|
85
|
+
type: :development
|
86
|
+
prerelease: false
|
87
|
+
version_requirements: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - "~>"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '2.4'
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.4'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: nokogiri
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '1.7'
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.7'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.7'
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '1.7'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: rspec-rails
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - '='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 4.0.2
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - '='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: 4.0.2
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: appraisal
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '2.1'
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.1'
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.1'
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '2.1'
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: simplecov
|
151
|
+
requirement: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - "~>"
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0.12'
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0.12'
|
159
|
+
type: :development
|
160
|
+
prerelease: false
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0.12'
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0.12'
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: simplecov-summary
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - "~>"
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 0.0.5
|
176
|
+
- - ">="
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 0.0.5
|
179
|
+
type: :development
|
180
|
+
prerelease: false
|
181
|
+
version_requirements: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 0.0.5
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 0.0.5
|
189
|
+
- !ruby/object:Gem::Dependency
|
190
|
+
name: mocha
|
191
|
+
requirement: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '1.2'
|
196
|
+
- - ">="
|
197
|
+
- !ruby/object:Gem::Version
|
198
|
+
version: '1.2'
|
199
|
+
type: :development
|
200
|
+
prerelease: false
|
201
|
+
version_requirements: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - "~>"
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '1.2'
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '1.2'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: coveralls
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - "~>"
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0.8'
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0.8'
|
219
|
+
type: :development
|
220
|
+
prerelease: false
|
221
|
+
version_requirements: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0.8'
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0.8'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: yard
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0.9'
|
236
|
+
- - ">="
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: 0.9.20
|
239
|
+
type: :development
|
240
|
+
prerelease: false
|
241
|
+
version_requirements: !ruby/object:Gem::Requirement
|
242
|
+
requirements:
|
243
|
+
- - "~>"
|
244
|
+
- !ruby/object:Gem::Version
|
245
|
+
version: '0.9'
|
246
|
+
- - ">="
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: 0.9.20
|
249
|
+
- !ruby/object:Gem::Dependency
|
250
|
+
name: yard-rspec
|
251
|
+
requirement: !ruby/object:Gem::Requirement
|
252
|
+
requirements:
|
253
|
+
- - "~>"
|
254
|
+
- !ruby/object:Gem::Version
|
255
|
+
version: '0.1'
|
256
|
+
- - ">="
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '0.1'
|
259
|
+
type: :development
|
260
|
+
prerelease: false
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
|
+
requirements:
|
263
|
+
- - "~>"
|
264
|
+
- !ruby/object:Gem::Version
|
265
|
+
version: '0.1'
|
266
|
+
- - ">="
|
267
|
+
- !ruby/object:Gem::Version
|
268
|
+
version: '0.1'
|
269
|
+
- !ruby/object:Gem::Dependency
|
270
|
+
name: redcarpet
|
271
|
+
requirement: !ruby/object:Gem::Requirement
|
272
|
+
requirements:
|
273
|
+
- - "~>"
|
274
|
+
- !ruby/object:Gem::Version
|
275
|
+
version: '3.4'
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '3.4'
|
279
|
+
type: :development
|
280
|
+
prerelease: false
|
281
|
+
version_requirements: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - "~>"
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '3.4'
|
286
|
+
- - ">="
|
287
|
+
- !ruby/object:Gem::Version
|
288
|
+
version: '3.4'
|
289
|
+
- !ruby/object:Gem::Dependency
|
290
|
+
name: github-markup
|
291
|
+
requirement: !ruby/object:Gem::Requirement
|
292
|
+
requirements:
|
293
|
+
- - "~>"
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
version: '1.4'
|
296
|
+
- - ">="
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '1.4'
|
299
|
+
type: :development
|
300
|
+
prerelease: false
|
301
|
+
version_requirements: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - "~>"
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: '1.4'
|
306
|
+
- - ">="
|
307
|
+
- !ruby/object:Gem::Version
|
308
|
+
version: '1.4'
|
309
|
+
- !ruby/object:Gem::Dependency
|
310
|
+
name: inch
|
311
|
+
requirement: !ruby/object:Gem::Requirement
|
312
|
+
requirements:
|
313
|
+
- - "~>"
|
314
|
+
- !ruby/object:Gem::Version
|
315
|
+
version: '0.7'
|
316
|
+
type: :development
|
317
|
+
prerelease: false
|
318
|
+
version_requirements: !ruby/object:Gem::Requirement
|
319
|
+
requirements:
|
320
|
+
- - "~>"
|
321
|
+
- !ruby/object:Gem::Version
|
322
|
+
version: '0.7'
|
41
323
|
description: 'WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/) '
|
42
324
|
email: raoul_ice@yahoo.com
|
43
325
|
executables: []
|
@@ -62,6 +344,7 @@ files:
|
|
62
344
|
- app/helpers/washout_builder_method_arguments_helper.rb
|
63
345
|
- app/helpers/washout_builder_method_list_helper.rb
|
64
346
|
- app/helpers/washout_builder_method_return_type_helper.rb
|
347
|
+
- app/helpers/washout_builder_shared_helper.rb
|
65
348
|
- app/views/wash_with_html/_complex_type.builder
|
66
349
|
- app/views/wash_with_html/_fault_type.builder
|
67
350
|
- app/views/wash_with_html/_public_method.builder
|
@@ -82,6 +365,7 @@ files:
|
|
82
365
|
- gemfiles/rails_5.2.4.gemfile
|
83
366
|
- gemfiles/rails_6.0.0.gemfile
|
84
367
|
- gemfiles/rails_6.0.1.gemfile
|
368
|
+
- gemfiles/rails_6.1.3.gemfile
|
85
369
|
- gemfiles/rails_api_4.2.7.gemfile
|
86
370
|
- init.rb
|
87
371
|
- install-travis-bundler.sh
|
@@ -92,7 +376,6 @@ files:
|
|
92
376
|
- lib/washout_builder/document/shared_complex_type.rb
|
93
377
|
- lib/washout_builder/engine.rb
|
94
378
|
- lib/washout_builder/env_checker.rb
|
95
|
-
- lib/washout_builder/param.rb
|
96
379
|
- lib/washout_builder/router.rb
|
97
380
|
- lib/washout_builder/soap.rb
|
98
381
|
- lib/washout_builder/type.rb
|
@@ -158,7 +441,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
441
|
- !ruby/object:Gem::Version
|
159
442
|
version: '0'
|
160
443
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
444
|
+
rubygems_version: 3.2.3
|
162
445
|
signing_key:
|
163
446
|
specification_version: 4
|
164
447
|
summary: WashOut Soap Service HTML-Documentation generator (extends WashOut https://github.com/inossidabile/wash_out/)
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module WashoutBuilder
|
2
|
-
# module that extends the base WashoutParam to allow parsing of definitions for building documentation
|
3
|
-
module Param
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
# Method that receives the arguments for a soap action (input or output) and tries to parse the definition (@see WashOutParam#parse_def)
|
7
|
-
#
|
8
|
-
# the following lines was removed from original method because when generating the documentation
|
9
|
-
# the "source_class" attrtibute of the object was not the name of the class of the complex tyoe
|
10
|
-
# but instead was the name given in the hash
|
11
|
-
#
|
12
|
-
# if definition.is_a?(Class) && definition.ancestors.include?(WashOut::Type)
|
13
|
-
# definition = definition.wash_out_param_map
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# @example Given the class ProjectType as a "definition" argument, the complex type name should be ProjectType and not "project"
|
17
|
-
# class ProjectType < WashOut::Type
|
18
|
-
# map :project => {
|
19
|
-
# :name => :string,
|
20
|
-
# :description => :string,
|
21
|
-
# :users => [{:mail => :string }],
|
22
|
-
# }
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
#
|
26
|
-
# @see WashoutBuilder::SOAP#soap_action
|
27
|
-
# @see WashOutParam#initialize
|
28
|
-
#
|
29
|
-
# @param [WasOut::SoapConfig] soap_config Holds the soap configuration for the entire web service
|
30
|
-
# @param [Object] definition Any type of object ( this is passed from the soap action)
|
31
|
-
#
|
32
|
-
# @return [Type] description of returned object
|
33
|
-
def parse_builder_def(soap_config, definition)
|
34
|
-
raise '[] should not be used in your params. Use nil if you want to mark empty set.' if definition == []
|
35
|
-
return [] if definition.blank?
|
36
|
-
|
37
|
-
definition = { value: definition } unless definition.is_a?(Hash) # for arrays and symbols
|
38
|
-
|
39
|
-
definition.map do |name, opt|
|
40
|
-
if opt.is_a? self
|
41
|
-
opt
|
42
|
-
elsif opt.is_a? Array
|
43
|
-
new(soap_config, name, opt[0], true)
|
44
|
-
else
|
45
|
-
new(soap_config, name, opt)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|