washout_builder 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/wash_with_html/_complex_type.builder +1 -1
- data/lib/washout_builder.rb +11 -2
- data/lib/washout_builder/document/complex_type.rb +1 -1
- data/lib/washout_builder/param.rb +28 -18
- data/lib/washout_builder/type.rb +14 -4
- data/lib/washout_builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce93207677248ea25aec7558a3266667c7e1ee45
|
4
|
+
data.tar.gz: 71325291f14d1069c7754c4ba5add1f367cd3335
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6ab9c9c591e68539ffd4f7052f723765a42adfc5401d53866578122771f36b61bfcb9ffb162f5e2b31a00cf15cf564f6cdee853b823f3cef80add358ba109c6
|
7
|
+
data.tar.gz: 70785954e5697320a6c42948f302205120df5632482be8420e38fe8a6b644c093321c0e89402fee3221920857e25d150ab7cd02500cd54b0204e76da8d294cd7
|
@@ -4,7 +4,7 @@ unless object.blank?
|
|
4
4
|
xml.h3 { |pre| pre << "#{class_name} #{ancestors.blank? ? "" : "<small>(extends <a href='##{ancestors[0].to_s.classify}'>#{ancestors[0].to_s.classify}</a>)</small>" } " }
|
5
5
|
|
6
6
|
|
7
|
-
if WashoutBuilder::Type.
|
7
|
+
if WashoutBuilder::Type.base_param_class.present? && object.is_a?(WashoutBuilder::Type.base_param_class)
|
8
8
|
xml.ul("class" => "pre") {
|
9
9
|
object.map.each do |element|
|
10
10
|
xml.li { |pre|
|
data/lib/washout_builder.rb
CHANGED
@@ -4,12 +4,16 @@ require 'active_support/core_ext/hash/keys'
|
|
4
4
|
require 'active_support/concern'
|
5
5
|
Gem.find_files('washout_builder/**/*.rb').each { |path| require path }
|
6
6
|
|
7
|
+
# finds all the exception class and extends them by including the ExceptionModel module in order to be
|
8
|
+
# able to generate documentation for exceptions
|
7
9
|
WashoutBuilder::Type.all_fault_classes.each do |exception_class|
|
8
10
|
exception_class.class_eval do
|
9
11
|
extend WashoutBuilder::Document::ExceptionModel
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
15
|
+
# finds all the classes that have defined the "soap_action" method and overrides it so that
|
16
|
+
# it parses the definition properly for generating documentation
|
13
17
|
WashoutBuilder::Type.all_controller_classes.each do |controller|
|
14
18
|
controller.class_eval do
|
15
19
|
alias_method :original_soap_action, :soap_action
|
@@ -17,13 +21,18 @@ WashoutBuilder::Type.all_controller_classes.each do |controller|
|
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
20
|
-
|
21
|
-
|
24
|
+
# find the class that is used for parsing definition of soap actions and add method for parsing definition
|
25
|
+
# and also includes the ComplexType module that is used for generating documentation
|
26
|
+
base_param_class = WashoutBuilder::Type.base_param_class
|
27
|
+
if base_param_class.present?
|
28
|
+
base_param_class.class_eval do
|
22
29
|
extend WashoutBuilder::Param
|
23
30
|
include WashoutBuilder::Document::ComplexType
|
24
31
|
end
|
25
32
|
end
|
26
33
|
|
34
|
+
# finds all the soap config classes that have the methods "config" and "keys" and overrides them in order to add the "description"key to the allowed keys
|
35
|
+
# this will allow webservices to specify a description besides the namespace and endpoint
|
27
36
|
WashoutBuilder::Type.all_soap_config_classes.each do |controller|
|
28
37
|
controller.class_eval do
|
29
38
|
singleton_class.send(:alias_method, :original_config, :config)
|
@@ -27,7 +27,7 @@ module WashoutBuilder
|
|
27
27
|
# @param [Class] complex_class the complex type name used for searching
|
28
28
|
#
|
29
29
|
# @return [Boolean] returns true or false if the complex type is found inside the array
|
30
|
-
#
|
30
|
+
# @raise [RuntimeError] Raises a runtime error if is detected a duplicate use of the complex type
|
31
31
|
# @api public
|
32
32
|
def check_duplicate_complex_class(defined, complex_class)
|
33
33
|
complex_obj_found = defined.find { |hash| hash[:class] == complex_class }
|
@@ -1,29 +1,39 @@
|
|
1
1
|
module WashoutBuilder
|
2
|
+
# module that extends the base WashoutParam to allow parsing of definitions for building documentation
|
2
3
|
module Param
|
3
4
|
extend ActiveSupport::Concern
|
4
5
|
|
6
|
+
# Method that receives the arguments for a soap action (input or output) and tries to parse the definition (@see WashOutParam#parse_def)
|
7
|
+
#
|
8
|
+
# the following lines was removed from original method because when generating the documentation
|
9
|
+
# the "source_class" attrtibute of the object was not the name of the class of the complex tyoe
|
10
|
+
# but instead was the name given in the hash
|
11
|
+
#
|
12
|
+
# if definition.is_a?(Class) && definition.ancestors.include?(WashOut::Type)
|
13
|
+
# definition = definition.wash_out_param_map
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# @example Given the class ProjectType as a "definition" argument, the complex type name should be ProjectType and not "project"
|
17
|
+
# class ProjectType < WashOut::Type
|
18
|
+
# map :project => {
|
19
|
+
# :name => :string,
|
20
|
+
# :description => :string,
|
21
|
+
# :users => [{:mail => :string }],
|
22
|
+
# }
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
#
|
26
|
+
# @see WashoutBuilder::SOAP#soap_action
|
27
|
+
# @see WashOutParam#initialize
|
28
|
+
#
|
29
|
+
# @param [WasOut::SoapConfig] soap_config Holds the soap configuration for the entire web service
|
30
|
+
# @param [Object] definition Any type of object ( this is passed from the soap action)
|
31
|
+
#
|
32
|
+
# @return [Type] description of returned object
|
5
33
|
def parse_builder_def(soap_config, definition)
|
6
34
|
raise '[] should not be used in your params. Use nil if you want to mark empty set.' if definition == []
|
7
35
|
return [] if definition.blank?
|
8
36
|
|
9
|
-
# the following lines was removed because when generating the documentation
|
10
|
-
# the "source_class" attrtibute of the object was not the name of the class of the complex tyoe
|
11
|
-
# but instead was the name given in the hash
|
12
|
-
# Example :
|
13
|
-
# class ProjectType < WashOut::Type
|
14
|
-
# map :project => {
|
15
|
-
# :name => :string,
|
16
|
-
# :description => :string,
|
17
|
-
# :users => [{:mail => :string }],
|
18
|
-
# }
|
19
|
-
# end
|
20
|
-
#
|
21
|
-
# The name of the complex type should be ProjectType and not "project"
|
22
|
-
|
23
|
-
# if definition.is_a?(Class) && definition.ancestors.include?(WashOut::Type)
|
24
|
-
# definition = definition.wash_out_param_map
|
25
|
-
# end
|
26
|
-
|
27
37
|
definition = { value: definition } unless definition.is_a?(Hash) # for arrays and symbols
|
28
38
|
|
29
39
|
definition.map do |name, opt|
|
data/lib/washout_builder/type.rb
CHANGED
@@ -16,6 +16,10 @@ module WashoutBuilder
|
|
16
16
|
classes
|
17
17
|
end
|
18
18
|
|
19
|
+
# returns all the controller classes that should override the "soap_action" method
|
20
|
+
#
|
21
|
+
# @return [Array<Class>] returns all the controller classes that should override the "soap_action" method
|
22
|
+
# @api public
|
19
23
|
def self.all_controller_classes
|
20
24
|
classes = []
|
21
25
|
classes << WashOut::Rails::Controller::ClassMethods if defined?(WashOut::Rails::Controller::ClassMethods)
|
@@ -23,12 +27,18 @@ module WashoutBuilder
|
|
23
27
|
classes
|
24
28
|
end
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
+
# returns the base class that is used for parsing definitions of soap actions
|
31
|
+
#
|
32
|
+
# @return [Class] returns the base class that is used for parsing definitions of soap actions
|
33
|
+
# @api public
|
34
|
+
def self.base_param_class
|
35
|
+
defined?(WashOut::Param) ? WashOut::Param : nil
|
30
36
|
end
|
31
37
|
|
38
|
+
# returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint
|
39
|
+
#
|
40
|
+
# @return [Array<Class>] returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint
|
41
|
+
# @api public
|
32
42
|
def self.all_soap_config_classes
|
33
43
|
classes = []
|
34
44
|
classes << WashOut::SoapConfig if defined?(WashOut::SoapConfig)
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: wash_out
|