washout_builder 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/helpers/washout_builder_helper.rb +53 -5
- data/lib/washout_builder/dispatcher.rb +1 -0
- data/lib/washout_builder/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGUxZmRiZjBjZmIwNzQ4NGIyYTg5N2Y3ZDJmNjNlODRkMjQxODYxMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2ZmOWM2ZjIzYTVlNDc3YjA4MDRmODI2YWIyNWJiNjhkZDI3MDBhZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjY2ZmE3NjZkZWQxNWQ1YWZmNTg5NDY0NGYwMjQ3MjQzMTQ0Njg3NzNjZTQy
|
10
|
+
NTljYzNhNGViOTAzNzU2ZTlmYzdhYWQ5OWQ5MDlhODFkZDJlMTMwMmJjYjU2
|
11
|
+
ZjJjZGY3MTdmMDMzYjE3MDc2NjU0YThiYjViMGNiMzQwNzg5ZTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWZkODA5ZTBmZGY5YzQ2YzBjZWNlMDY3NTdiMjQ1NGUwOGU3ZmVlOTRjOTdh
|
14
|
+
NWUwMzE3YzFlZDYzODQzZjM3Y2RhOTY0NGU5ZGVmNDViMGMwYzAwMDhhNjNj
|
15
|
+
NDRlMDk2ZmUxODg1YjZmZDlmNWExMzFjYjA1ZDUzYjA0OTM2ZGI=
|
@@ -17,11 +17,58 @@ module WashoutBuilderHelper
|
|
17
17
|
return complex_class
|
18
18
|
end
|
19
19
|
|
20
|
+
|
21
|
+
def get_param_structure(param)
|
22
|
+
param.map.inject({}) {|h,element| h[element.name] = element.type;h }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def remove_type_inheritable_elements(param, keys)
|
27
|
+
param.map.delete_if{|element| keys.include?(element.name) }
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def same_structure_as_ancestor?(param, ancestor)
|
32
|
+
param_structure = get_param_structure(param)
|
33
|
+
ancestor_structure = get_param_structure(ancestor)
|
34
|
+
if param_structure.keys == ancestor_structure.keys
|
35
|
+
return true
|
36
|
+
else
|
37
|
+
remove_type_inheritable_elements(param, ancestor_structure.keys)
|
38
|
+
return false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
def get_class_ancestors(param,class_name, defined)
|
46
|
+
bool_the_same = false
|
47
|
+
param_class = class_name.is_a?(Class) ? class_name : class_name.constantize
|
48
|
+
ancestors = param_class.ancestors - param_class.included_modules
|
49
|
+
ancestors.delete_if{ |x| x.to_s.downcase == class_name.to_s.downcase || x.to_s == "ActiveRecord::Base" || x.to_s == "Object" || x.to_s =="BasicObject" || x.to_s == "WashOut::Type" }
|
50
|
+
unless ancestors.blank?
|
51
|
+
ancestor_class = ancestors[0]
|
52
|
+
ancestor_structure = {ancestor_class.to_s.downcase => ancestor_class.columns_hash.inject({}) {|h, (k,v)| h["#{k}"]="#{v.type}".to_sym; h } }
|
53
|
+
ancestor_object = WashoutBuilder::Param.parse_def(@soap_config,ancestor_structure)[0]
|
54
|
+
bool_the_same = same_structure_as_ancestor?(param, ancestor_object)
|
55
|
+
unless bool_the_same
|
56
|
+
top_ancestors = get_class_ancestors(ancestor_class, defined)
|
57
|
+
defined << {:class =>ancestor_class.to_s, :obj =>ancestor_object , :ancestors => top_ancestors }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
ancestors unless bool_the_same
|
61
|
+
end
|
62
|
+
|
20
63
|
|
21
64
|
def get_nested_complex_types(param, defined)
|
22
65
|
defined = [] if defined.blank?
|
23
66
|
complex_class = get_complex_class_name(param, defined)
|
24
|
-
|
67
|
+
if param.classified?
|
68
|
+
defined << {:class =>complex_class, :obj => param, :ancestors => get_class_ancestors(param, complex_class, defined)} unless complex_class.nil?
|
69
|
+
else
|
70
|
+
defined << {:class =>complex_class, :obj => param} unless complex_class.nil?
|
71
|
+
end
|
25
72
|
if param.is_complex?
|
26
73
|
c_names = []
|
27
74
|
param.map.each do |obj|
|
@@ -57,21 +104,22 @@ module WashoutBuilderHelper
|
|
57
104
|
|
58
105
|
def create_html_complex_types(xml, types)
|
59
106
|
types.each do |hash|
|
60
|
-
create_complex_type_html(xml, hash[:obj], hash[:class])
|
107
|
+
create_complex_type_html(xml, hash[:obj], hash[:class], hash[:ancestors])
|
61
108
|
end
|
62
109
|
end
|
63
110
|
|
64
111
|
|
65
112
|
|
66
|
-
def create_complex_type_html(xml, param, class_name)
|
113
|
+
def create_complex_type_html(xml, param, class_name, ancestors)
|
67
114
|
unless param.blank?
|
68
115
|
xml.a( "name" => "#{class_name}") { }
|
69
|
-
xml.h3 "#{class_name}"
|
116
|
+
xml.h3 { |pre| pre << "#{class_name} #{ancestors.blank? ? "" : "(extends <a href='##{ancestors[0].to_s.classify}'> #{ancestors[0].to_s.classify} )</a>" } " }
|
70
117
|
|
71
118
|
if param.is_a?(WashoutBuilder::Param)
|
72
119
|
xml.ul("class" => "pre") {
|
73
|
-
|
120
|
+
|
74
121
|
param.map.each do |element|
|
122
|
+
element.type = "string" if element.type == "text"
|
75
123
|
# raise YAML::dump(element) if class_name.include?("ype") and element.name == "members"
|
76
124
|
xml.li { |pre|
|
77
125
|
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
|
@@ -13,6 +13,7 @@ module WashoutBuilder
|
|
13
13
|
@name = controller_path.gsub('/', '_')
|
14
14
|
@service = self.class.name.underscore.gsub("_controller", "").camelize
|
15
15
|
@endpoint = @namespace.gsub("/wsdl", "/action")
|
16
|
+
@soap_config = soap_config
|
16
17
|
|
17
18
|
render :template => "wash_with_html/doc", :layout => false,
|
18
19
|
:content_type => 'text/html'
|