washout_builder 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df24805fd747f5ee4264ddd30bbb664a64980fed
|
4
|
+
data.tar.gz: e1f7a66e3c6ae46f56fc8230defef7d17fd850de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 746b52b2afc23edcf448c2d140a8cb4c40646728484aeb28a5a069beb92711d48fc48a9788aa604d44bf2e0cdb1150ecfdeb3b41684058ae4c3bf886dbbef25f
|
7
|
+
data.tar.gz: 9a5839e1fba426d88f22711b1d9055f17a50b7c0c02456b070f39b2643c9150c8eafc2edfe7fab085f6a1388107b12422f437f4e49dd23f06f021d3dd3be918f
|
@@ -15,19 +15,20 @@ module WashoutBuilder
|
|
15
15
|
#
|
16
16
|
# @api public
|
17
17
|
def all
|
18
|
+
@routes = find_all_routes
|
18
19
|
route = params[:name].present? ? controller_is_a_service?(params[:name]) : nil
|
19
20
|
if route.present?
|
20
21
|
@document = WashoutBuilder::Document::Generator.new(route.defaults[:controller])
|
21
22
|
render template: 'wash_with_html/doc', layout: false,
|
22
|
-
|
23
|
+
content_type: 'text/html'
|
23
24
|
else
|
24
25
|
@services = all_services
|
25
26
|
render template: 'wash_with_html/all_services', layout: false,
|
26
|
-
|
27
|
+
content_type: 'text/html'
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
|
-
|
31
|
+
private
|
31
32
|
|
32
33
|
# tries to find all services by searching through the rails controller
|
33
34
|
# and returns their namespace, endpoint and a documentation url
|
@@ -74,6 +75,17 @@ module WashoutBuilder
|
|
74
75
|
route.defaults[:action] == '_generate_wsdl'
|
75
76
|
end
|
76
77
|
|
78
|
+
def find_all_routes
|
79
|
+
rails_routes = Rails.application.routes.routes.map {|route| route }
|
80
|
+
engine_routes = []
|
81
|
+
::Rails::Engine.subclasses.each do |engine|
|
82
|
+
engine.routes.routes.each do |route|
|
83
|
+
engine_routes << route
|
84
|
+
end
|
85
|
+
end
|
86
|
+
rails_routes.concat(engine_routes).uniq.compact
|
87
|
+
end
|
88
|
+
|
77
89
|
# method for getting all controllers that have the generate wsdl action or finding out
|
78
90
|
# if a single controller is a soap service
|
79
91
|
# @see #route_can_generate_wsdl?
|
@@ -86,7 +98,7 @@ module WashoutBuilder
|
|
86
98
|
#
|
87
99
|
# @api private
|
88
100
|
def map_controllers(action = 'map')
|
89
|
-
res =
|
101
|
+
res = @routes.send(action) do |route|
|
90
102
|
if route_can_generate_wsdl?(route)
|
91
103
|
yield route if block_given?
|
92
104
|
end
|
@@ -18,13 +18,23 @@ module WashoutBuilderComplexTypeHelper
|
|
18
18
|
element.type = 'integer' if element.type == 'int'
|
19
19
|
if WashoutBuilder::Type::BASIC_TYPES.include?(element.type)
|
20
20
|
pre << "<span class='blue'>#{element.type}</span> <span class='bold'>#{element.name}</span>"
|
21
|
-
pre << " <span>#{element_description}</span>" unless element_description.blank?
|
21
|
+
pre << " <span>#{html_safe(element_description)}</span>" unless element_description.blank?
|
22
22
|
pre
|
23
23
|
else
|
24
24
|
create_complex_element_type_html(pre, element, element_description)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
# used for escaping strings
|
29
|
+
# @param [String] string The string that needs to be escaped
|
30
|
+
#
|
31
|
+
# @return [String]
|
32
|
+
#
|
33
|
+
# @api public
|
34
|
+
def html_safe(string)
|
35
|
+
string.present? ? ActiveSupport::SafeBuffer.new(string) : string
|
36
|
+
end
|
37
|
+
|
28
38
|
# checks if a complex attribute of a complex type is a array or not
|
29
39
|
# and retrieves the complex class name of the attribute and prints it
|
30
40
|
# @see WashoutBuilder::Document::ComplexType#find_complex_class_name
|
@@ -41,7 +51,7 @@ module WashoutBuilderComplexTypeHelper
|
|
41
51
|
return if complex_class.nil?
|
42
52
|
complex_class_content = element.multiplied == false ? "#{complex_class}" : "Array of #{complex_class}"
|
43
53
|
pre << "<a href='##{complex_class}'><span class='lightBlue'>#{complex_class_content}</span></a> <span class='bold'>#{element.name}</span>"
|
44
|
-
pre << " <span>#{element_description}</span>" unless element_description.blank?
|
54
|
+
pre << " <span>#{html_safe(element_description)}</span>" unless element_description.blank?
|
45
55
|
pre
|
46
56
|
end
|
47
57
|
end
|
data/lib/washout_builder.rb
CHANGED
@@ -2,6 +2,8 @@ require 'wash_out'
|
|
2
2
|
require 'active_support/core_ext/object/blank'
|
3
3
|
require 'active_support/core_ext/hash/keys'
|
4
4
|
require 'active_support/concern'
|
5
|
+
require 'active_support/core_ext/string/output_safety.rb'
|
6
|
+
|
5
7
|
Gem.find_files('washout_builder/**/*.rb').each { |path| require path }
|
6
8
|
|
7
9
|
# finds all the exception class and extends them by including the ExceptionModel module in order to be
|
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: 1.0.
|
4
|
+
version: 1.0.10
|
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: 2016-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wash_out
|