washout_builder 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/washout_builder/document/complex_type.rb +25 -14
- data/lib/washout_builder/soap.rb +4 -2
- data/lib/washout_builder/type.rb +7 -0
- data/lib/washout_builder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90cecf99023dfa0b735e1089ba1cb4eb5b077b26
|
4
|
+
data.tar.gz: 900363bc936101a18329bd7f3763c379307b76d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd47a0cea30d670da9337b8f9dc500363503845350e3fbee7063506511c63a9ea138588ba71d360293a174cbde1bcaba7a878a27f32e79983468def29865271
|
7
|
+
data.tar.gz: f7de742d4af8d318ab18029986788eb8610340aa1f987243940ca85d0af7f81860283005401bdc645dfb4bb4710a6ffd27123ae1c09b5c8df064ec2e6377262e
|
@@ -81,17 +81,27 @@ module WashoutBuilder
|
|
81
81
|
# @return [void]
|
82
82
|
# @api public
|
83
83
|
def fix_descendant_wash_out_type(config, complex_class)
|
84
|
-
param_class =
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
descendant = WashOut::Param.parse_builder_def(config, param_class.wash_out_param_map)[0]
|
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]
|
91
90
|
self.name = descendant.name
|
92
91
|
self.map = descendant.map
|
93
92
|
end
|
94
93
|
|
94
|
+
# Description of method
|
95
|
+
#
|
96
|
+
# @param [String] complex_class A string that contains the name of a class
|
97
|
+
# @return [Class, nil] returns the class if it is defined otherwise nil
|
98
|
+
# @api public
|
99
|
+
def find_class_from_string(complex_class)
|
100
|
+
complex_class.is_a?(Class) ? complex_class : complex_class.constantize
|
101
|
+
rescue
|
102
|
+
nil
|
103
|
+
end
|
104
|
+
|
95
105
|
# Method that is used to check if the current object has exactly same structure as one of his ancestors
|
96
106
|
# if it is true, will return true, otherwise will first remove the inheritated elements from his ancestor and then return false
|
97
107
|
# @see #find_param_structure
|
@@ -120,15 +130,14 @@ module WashoutBuilder
|
|
120
130
|
# 'ActiveRecord::Base', 'Object', 'BasicObject', 'WashOut::Type'
|
121
131
|
# @api public
|
122
132
|
def get_ancestors(class_name)
|
123
|
-
param_class =
|
124
|
-
class_name.is_a?(Class) ? class_name : class_name.constantize
|
125
|
-
rescue
|
126
|
-
nil
|
127
|
-
end
|
133
|
+
param_class = find_class_from_string(class_name)
|
128
134
|
if param_class.nil?
|
129
135
|
return nil
|
130
136
|
else
|
131
|
-
|
137
|
+
base_type_class = WashoutBuilder::Type.base_type_class
|
138
|
+
filtered_classes = ['ActiveRecord::Base', 'Object', 'BasicObject']
|
139
|
+
filtered_classes << base_type_class.to_s if base_type_class.present?
|
140
|
+
get_complex_type_ancestors(param_class, filtered_classes)
|
132
141
|
end
|
133
142
|
end
|
134
143
|
|
@@ -210,7 +219,9 @@ module WashoutBuilder
|
|
210
219
|
def get_class_ancestors(config, class_name, defined)
|
211
220
|
ancestors = get_ancestors(class_name)
|
212
221
|
return if ancestors.blank?
|
213
|
-
|
222
|
+
base_param_class = WashoutBuilder::Type.base_param_class
|
223
|
+
return if base_param_class.blank?
|
224
|
+
ancestor_object = base_param_class.parse_def(config, ancestor_structure(ancestors))[0]
|
214
225
|
bool_the_same = same_structure_as_ancestor?(ancestor_object)
|
215
226
|
unless bool_the_same
|
216
227
|
top_ancestors = get_class_ancestors(config, ancestors[0], defined)
|
data/lib/washout_builder/soap.rb
CHANGED
@@ -30,8 +30,10 @@ module WashoutBuilder
|
|
30
30
|
end
|
31
31
|
|
32
32
|
current_action = soap_actions[action]
|
33
|
-
|
34
|
-
|
33
|
+
base_param_class = WashoutBuilder::Type.base_param_class
|
34
|
+
return if base_param_class.blank?
|
35
|
+
current_action[:builder_in] = base_param_class.parse_builder_def(soap_config, options[:args])
|
36
|
+
current_action[:builder_out] = base_param_class.parse_builder_def(soap_config, options[:return])
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
data/lib/washout_builder/type.rb
CHANGED
@@ -35,6 +35,13 @@ module WashoutBuilder
|
|
35
35
|
defined?(WashOut::Param) ? WashOut::Param : nil
|
36
36
|
end
|
37
37
|
|
38
|
+
# returns the base class that is used for WashOut types
|
39
|
+
#
|
40
|
+
# @return [Class] returns the base class that is used for WashOut types
|
41
|
+
# @api public
|
42
|
+
def self.base_type_class
|
43
|
+
defined?(WashOut::Type) ? WashOut::Type : nil
|
44
|
+
end
|
38
45
|
# returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint
|
39
46
|
#
|
40
47
|
# @return [Array<Class>] returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint
|