washout_builder 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZmE5NjdmOTMyMGZiYzYxN2UzMDMxMzA2MjJlMzZmNGIwZDRhYzhhZg==
4
+ YzcyOGJiYmFlYzkzYWM4MjFhYjY0ZmM2YWMwYTkzYzk4NzFhZmEzYw==
5
5
  data.tar.gz: !binary |-
6
- OTdiNWMwMWE5Njg1NTdhZTFkM2ZkNThlZGFlNDllMjkyZjM0ZTgyOQ==
6
+ YWUwYjdkZDFmZGQ1ZTU2OWFmMWZiODM2YzAwYmI0ZDI2NmUwYjA4NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDA2NTk0YTU2NTMxYzg0MTNjNTRmY2RhZWY5OThkZmZhZTdmODQ3NzNmYjQz
10
- MGE5OGIzMGZkMjJhYWUwMjA4OGFkOThjODhjYWVjMWQ5ODJkYmNkZTNlMmEz
11
- OTBkN2E3OGNkZWZlMjdkZDQxNTMyMTczNTFiMmI0YTgyODJhYzE=
9
+ ZDhhMGJlNmZlNjI5NjczMWMyZmM2N2EwOTU4ZDQyYWI1MWM4NzI5OGQ1ODkx
10
+ MWFmZTJkMzliNjgyZjBiM2U2NWZkMzE4ZmJmZDU0YTExOGQ1NDEyY2E2MTY2
11
+ ZGM0ZTI4OTNlOTJkMTU4ZDY5MjRiNjM4ZGUwN2NhMmNkYmM0Njk=
12
12
  data.tar.gz: !binary |-
13
- MzZmOWQ1OGJiMzM3OTJmNTUyN2MwNmZjOTA1ZWI2NjYyMmEyNjRjZWI4MjUz
14
- MWEyMmIwOGI3MTQ0NzZjYWU5ODhmNzVlZjM4YWU5MWZlM2JlOTUwYzkzODA4
15
- MzA3NGI0M2EwYTZlMmMyZTU0MjA3MjM4ODg4NjY3NGM2ZTE4ZDA=
13
+ OTE2NThiMDNlMGQzOTAwMzJhOGUwMjU5NTQ3MTM4MmU5ZjU2MDJlODE1Y2Uw
14
+ OTYwZDNhZTJkZjg3N2Q0ODM5YTExM2QyNDcyZjk2NTIyYWM1ZmFmNWIyYTMz
15
+ YjM3NmJjNjg2MDAxM2Q1ZDRjNzQ2ZWNiOTVhOGExNDM1YmY5OWI=
@@ -2,10 +2,9 @@ module WashoutBuilderHelper
2
2
  include WashOutHelper
3
3
 
4
4
  def get_complex_class_name(p, defined = [])
5
- complex_class = nil
6
- complex_class = p.basic_type.to_s.classify if p.is_complex?
7
-
8
- if !complex_class.nil? && !defined.blank?
5
+ complex_class = p.is_complex? ? p.basic_type.to_s.classify : nil
6
+
7
+ unless complex_class.nil? || defined.blank?
9
8
 
10
9
  complex_obj_found = defined.detect {|hash| hash[:class] == complex_class}
11
10
 
@@ -45,11 +44,9 @@ module WashoutBuilderHelper
45
44
  def get_class_ancestors(param,class_name, defined)
46
45
  bool_the_same = false
47
46
  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" }
47
+ ancestors = (param_class.ancestors - param_class.included_modules).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
48
  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 } }
49
+ ancestor_structure = { ancestors[0].to_s.downcase => ancestors[0].columns_hash.inject({}) {|h, (k,v)| h["#{k}"]="#{v.type}".to_sym; h } }
53
50
  ancestor_object = WashoutBuilder::Param.parse_def(@soap_config,ancestor_structure)[0]
54
51
  bool_the_same = same_structure_as_ancestor?(param, ancestor_object)
55
52
  unless bool_the_same
@@ -64,17 +61,10 @@ module WashoutBuilderHelper
64
61
  def get_nested_complex_types(param, defined)
65
62
  defined = [] if defined.blank?
66
63
  complex_class = get_complex_class_name(param, defined)
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
64
+ defined << {:class =>complex_class, :obj => param, :ancestors => param.classified? ? get_class_ancestors(param, complex_class, defined) : nil } unless complex_class.nil?
72
65
  if param.is_complex?
73
66
  c_names = []
74
- param.map.each do |obj|
75
- nested = get_nested_complex_types(obj, defined)
76
- c_names.concat(nested)
77
- end
67
+ param.map.each { |obj| c_names.concat(get_nested_complex_types(obj, defined)) }
78
68
  defined.concat(c_names)
79
69
  end
80
70
  defined.sort_by { |hash| hash[:class].downcase }.uniq unless defined.blank?
@@ -85,8 +75,7 @@ module WashoutBuilderHelper
85
75
  defined = []
86
76
  map.each do |operation, formats|
87
77
  (formats[:input] + formats[:output]).each do |p|
88
- nested = get_nested_complex_types(p, defined)
89
- defined.concat(nested)
78
+ defined.concat(get_nested_complex_types(p, defined))
90
79
  end
91
80
  end
92
81
  defined.sort_by { |hash| hash[:class].downcase }.uniq unless defined.blank?
@@ -103,9 +92,7 @@ module WashoutBuilderHelper
103
92
 
104
93
 
105
94
  def create_html_complex_types(xml, types)
106
- types.each do |hash|
107
- create_complex_type_html(xml, hash[:obj], hash[:class], hash[:ancestors])
108
- end
95
+ types.each { |hash| create_complex_type_html(xml, hash[:obj], hash[:class], hash[:ancestors]) }
109
96
  end
110
97
 
111
98
 
@@ -148,9 +135,7 @@ module WashoutBuilderHelper
148
135
  defined = map.select{|operation, formats| !formats[:raises].blank? }
149
136
  unless defined.blank?
150
137
  defined = defined.collect {|operation, formats| formats[:raises].is_a?(Array) ? formats[:raises] : [formats[:raises]] }.flatten.sort_by { |item| item.class.to_s.downcase }.uniq
151
- defined.each do |fault|
152
- create_html_fault_type(xml, fault)
153
- end
138
+ defined.each { |fault| create_html_fault_type(xml, fault) }
154
139
  end
155
140
  end
156
141
 
@@ -183,10 +168,7 @@ module WashoutBuilderHelper
183
168
  def create_html_public_methods(xml, map)
184
169
  unless map.blank?
185
170
  map =map.sort_by { |operation, formats| operation.downcase }.uniq
186
-
187
- map.each do |operation, formats|
188
- create_html_public_method(xml, operation, formats)
189
- end
171
+ map.each { |operation, formats| create_html_public_method(xml, operation, formats) }
190
172
  end
191
173
  end
192
174
 
@@ -1,3 +1,3 @@
1
1
  module WashoutBuilder
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
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.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada