Class: WashoutBuilder::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/washout_builder/type.rb

Overview

class that is used to define the basic types and the basic exception classes that should be considered

Constant Summary collapse

BASIC_TYPES =

the basic types that are considered when checking an object type

%w(string integer double boolean date datetime float time int)

Class Method Summary collapse

Class Method Details

.all_controller_classesArray<Class>

returns all the controller classes that should override the “soap_action” method

Returns:

  • (Array<Class>)

    returns all the controller classes that should override the “soap_action” method



23
24
25
26
27
28
# File 'lib/washout_builder/type.rb', line 23

def self.all_controller_classes
  classes = []
  classes << WashOut::Rails::Controller::ClassMethods if defined?(WashOut::Rails::Controller::ClassMethods)
  classes << WashOut::SOAP::ClassMethods if defined?(WashOut::SOAP::ClassMethods)
  classes
end

.all_fault_classesArray<Class>

returns all the exception classes that should be considered to be detected

Returns:

  • (Array<Class>)

    returns all the exception classes that should be considered to be detected



11
12
13
14
15
16
17
# File 'lib/washout_builder/type.rb', line 11

def self.all_fault_classes
  classes = []
  classes << WashOut::SOAPError if defined?(WashOut::SOAPError)
  classes << WashOut::Dispatcher::SOAPError if defined?(WashOut::Dispatcher::SOAPError)
  classes << SOAPError if defined?(SOAPError)
  classes
end

.all_soap_config_classesArray<Class>

returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint

Returns:

  • (Array<Class>)

    returns all the soap config classss that should be overriden to allow description of web service also besides namespace and endpoint



50
51
52
53
54
# File 'lib/washout_builder/type.rb', line 50

def self.all_soap_config_classes
  classes = []
  classes << WashOut::SoapConfig if defined?(WashOut::SoapConfig)
  classes
end

.ancestor_fault?(fault_class) ⇒ Boolean

Checks if a exception class inherits from the basic ones

Parameters:

  • fault_class (Class)

    the exception class that needs to be checks if has as ancestor one of the base classes

Returns:

  • (Boolean)

    Returns true if the class inherits from the basic classes or false otherwise

See Also:

  • #all_fault_classes


62
63
64
# File 'lib/washout_builder/type.rb', line 62

def self.ancestor_fault?(fault_class)
  fault_class.ancestors.find { |fault| all_fault_classes.include?(fault) }.present?
end

.base_param_classClass

returns the base class that is used for parsing definitions of soap actions

Returns:

  • (Class)

    returns the base class that is used for parsing definitions of soap actions



34
35
36
# File 'lib/washout_builder/type.rb', line 34

def self.base_param_class
  defined?(WashOut::Param) ? WashOut::Param : nil
end

.base_type_classClass

returns the base class that is used for WashOut types

Returns:

  • (Class)

    returns the base class that is used for WashOut types



42
43
44
# File 'lib/washout_builder/type.rb', line 42

def self.base_type_class
  defined?(WashOut::Type) ? WashOut::Type : nil
end

.valid_fault_class?(fault) ⇒ Boolean

Checks if a exception class is valid, by checking if either is a basic exception class or has as ancerstor one ot the base classes

Parameters:

  • fault (Class)

    The exception class that needs to be checks if has as ancestor one of the base classes or is one of them

Returns:

  • (Boolean)

    Returns true if the class inherits from the basic classes or is one of them, otherwise false



71
72
73
# File 'lib/washout_builder/type.rb', line 71

def self.valid_fault_class?(fault)
  fault.is_a?(Class) && (ancestor_fault?(fault) || all_fault_classes.include?(fault))
end