washout_builder 0.11.7 → 0.11.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/washout_builder.rb +1 -0
- data/lib/washout_builder/document/complex_type.rb +2 -1
- data/lib/washout_builder/document/generator.rb +33 -16
- data/lib/washout_builder/document/shared_complex_type.rb +11 -0
- data/lib/washout_builder/document/virtus_model.rb +6 -1
- data/lib/washout_builder/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzcwZTFhNDc1MDQ4MDlkOTMzNDk2NjlkNjVjZDUzMmZiM2I1OGI1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzYzYmE5NmFjNDMyNmEyMTdiODhjMTE4NzBmNjUwZTE0NTcxNTA2YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjRkMTNlNjY4M2M0NTExYzMxOTE3NmU0ZDE4NjEyMzZjMmRiYzYzMWZmYjM2
|
10
|
+
YjQ3YTRkNGY5YmI3OWQ0ODAzNzQ3YzU2N2JlYTU0NzFmODA2MTRhMGNmNTE3
|
11
|
+
NGVkOGY3ZmQ3YWNjMmIwZmYyMzFjNmRkOWM1NzZlN2Q1MDBkODE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWJhZTUzNGQwYmY3Y2I2YmZkNjBlMjMwOTdhZjlkYzY5YmFkYWNmZTVhOWFh
|
14
|
+
ZmFmMDA3NTRmMWZkODc5N2M5NjhhMmU2OWQxNmNmMjM0MjM2OWU4ZDQ1ZTEz
|
15
|
+
NGFjODg1NWJhZTdjM2ViZTU4NmYwNDU4ZWU5OTBkYjhjMzQ0YTM=
|
data/lib/washout_builder.rb
CHANGED
@@ -2,6 +2,7 @@ require 'wash_out'
|
|
2
2
|
require 'virtus'
|
3
3
|
require 'washout_builder/soap'
|
4
4
|
require 'washout_builder/engine'
|
5
|
+
require 'washout_builder/document/shared_complex_type'
|
5
6
|
require 'washout_builder/document/complex_type'
|
6
7
|
require 'washout_builder/document/virtus_model'
|
7
8
|
require 'washout_builder/document/generator'
|
@@ -2,6 +2,7 @@ module WashoutBuilder
|
|
2
2
|
module Document
|
3
3
|
module ComplexType
|
4
4
|
extend ActiveSupport::Concern
|
5
|
+
include WashoutBuilder::Document::SharedComplexType
|
5
6
|
|
6
7
|
|
7
8
|
def get_complex_class_name(defined = [])
|
@@ -66,7 +67,7 @@ module WashoutBuilder
|
|
66
67
|
if param_class.nil?
|
67
68
|
return nil
|
68
69
|
else
|
69
|
-
(param_class
|
70
|
+
get_complex_type_ancestors(param_class, ["ActiveRecord::Base", "Object", "BasicObject", "WashOut::Type" ])
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
@@ -34,8 +34,8 @@ module WashoutBuilder
|
|
34
34
|
soap_actions.map { |operation, formats| operation }
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
types.sort_by { |hash| hash[
|
37
|
+
def sort_complex_types(types, type)
|
38
|
+
types.sort_by { |hash| hash[type.to_sym].to_s.downcase }.uniq {|hash| hash[type.to_sym] } unless types.blank?
|
39
39
|
end
|
40
40
|
|
41
41
|
|
@@ -70,7 +70,7 @@ module WashoutBuilder
|
|
70
70
|
(input_types + output_types).each do |p|
|
71
71
|
defined.concat(p.get_nested_complex_types(config, defined))
|
72
72
|
end
|
73
|
-
defined
|
73
|
+
defined = sort_complex_types(defined, "class")
|
74
74
|
end
|
75
75
|
|
76
76
|
|
@@ -79,25 +79,42 @@ module WashoutBuilder
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def exceptions_raised
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
actions_with_exceptions.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten
|
83
|
+
end
|
84
|
+
|
85
|
+
def fault_classes
|
86
|
+
WashoutBuilder::Type.get_fault_classes
|
87
|
+
end
|
88
|
+
|
89
|
+
def has_ancestor_fault?(fault_class)
|
90
|
+
fault_class.ancestors.detect{ |fault| fault_classes.include?(fault) }.present?
|
91
|
+
end
|
92
|
+
|
93
|
+
def valid_fault_class?(fault)
|
94
|
+
fault.is_a?(Class) && ( has_ancestor_fault?(fault) || fault_classes.include?(fault))
|
95
|
+
end
|
96
|
+
|
97
|
+
def filter_exceptions_raised
|
98
|
+
exceptions_raised.select { |x| valid_fault_class?(x) } unless actions_with_exceptions.blank?
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_complex_fault_types(fault_types)
|
102
|
+
defined = filter_exceptions_raised
|
103
|
+
if defined.blank?
|
104
|
+
defined = [fault_classes.first]
|
86
105
|
else
|
87
|
-
|
106
|
+
defined << fault_classes.first
|
88
107
|
end
|
89
|
-
|
108
|
+
defined.each{ |exception_class| exception_class.get_fault_class_ancestors( fault_types, true)} unless defined.blank?
|
109
|
+
fault_types
|
90
110
|
end
|
91
111
|
|
92
|
-
|
93
112
|
def fault_types
|
94
|
-
|
95
|
-
fault_types = []
|
96
|
-
defined.each{ |exception_class| exception_class.get_fault_class_ancestors( fault_types, true)} unless defined.blank?
|
113
|
+
fault_types = get_complex_fault_types([])
|
97
114
|
complex_types = extract_nested_complex_types_from_exceptions(fault_types)
|
98
|
-
complex_types.delete_if{ |hash| fault_types << hash
|
99
|
-
fault_types =
|
100
|
-
complex_types =
|
115
|
+
complex_types.delete_if{ |hash| fault_types << hash if valid_fault_class?(hash[:fault]) } unless complex_types.blank?
|
116
|
+
fault_types = sort_complex_types(fault_types, "fault")
|
117
|
+
complex_types = sort_complex_types(complex_types, "fault")
|
101
118
|
[fault_types, complex_types]
|
102
119
|
end
|
103
120
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module WashoutBuilder
|
2
|
+
module Document
|
3
|
+
module SharedComplexType
|
4
|
+
|
5
|
+
def get_complex_type_ancestors(class_name, array)
|
6
|
+
(class_name.ancestors - class_name.included_modules).delete_if{ |x| x.to_s.downcase == class_name.to_s.downcase || array.include?(x.to_s) }
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -2,6 +2,11 @@ module WashoutBuilder
|
|
2
2
|
module Document
|
3
3
|
module VirtusModel
|
4
4
|
extend ActiveSupport::Concern
|
5
|
+
include WashoutBuilder::Document::SharedComplexType
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.send :include, WashoutBuilder::Document::SharedComplexType
|
9
|
+
end
|
5
10
|
|
6
11
|
def get_fault_class_ancestors( defined, debug = false)
|
7
12
|
bool_the_same = false
|
@@ -21,7 +26,7 @@ module WashoutBuilder
|
|
21
26
|
end
|
22
27
|
|
23
28
|
def fault_ancestors
|
24
|
-
(self
|
29
|
+
get_complex_type_ancestors(self, ["ActiveRecord::Base", "Object", "BasicObject", "Exception" ])
|
25
30
|
end
|
26
31
|
|
27
32
|
def fault_ancestor_hash( structure, ancestors)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: washout_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- lib/washout_builder/dispatcher.rb
|
78
78
|
- lib/washout_builder/document/complex_type.rb
|
79
79
|
- lib/washout_builder/document/generator.rb
|
80
|
+
- lib/washout_builder/document/shared_complex_type.rb
|
80
81
|
- lib/washout_builder/document/virtus_model.rb
|
81
82
|
- lib/washout_builder/engine.rb
|
82
83
|
- lib/washout_builder/soap.rb
|