class SoapEnumerator::Types::Schema

Schema class contains all schema elements as objects.

It dynamically detects schema attributes then generates
attributes for these attributes.
Also, it contains the complexType and simpleType objects

@example:

@see #Types

Attributes

attributes[R]

@!attribute attributes

complex_types[R]

@!attribute complex_types

simple_types[R]

@!attribute simple_types

Public Class Methods

new(schema_doc) click to toggle source
# File lib/soap_enumerator/types/schema.rb, line 25
def initialize(schema_doc)
  @attributes    = attributes_2_methods(schema_doc)
  @complex_types = get_complex_types(schema_doc)
  @simple_types  = get_simple_types(schema_doc)
end

Private Instance Methods

get_complex_types(schema_doc) click to toggle source

get_complex_types method

@param [Nokogiri::XML::Document] schema_doc

@return [Array<ComplexType>]

return object of [ComplexType] contains the name of the complexType
and array of all existing types. (@see #Schema::ComplexType)
# File lib/soap_enumerator/types/schema.rb, line 40
def get_complex_types(schema_doc)
  search_terms = ['//./xsd:complexType', '//./s:complexType', '//./complexType']
  safe_search(search_terms, schema_doc)&.map do |comp_types_doc|
    Types::Schema::ComplexType.new(comp_types_doc) unless comp_types_doc.nil?
  end.compact
end
get_simple_types(schema_doc) click to toggle source

get_simple_types method

@param [Nokogiri::XML::Document] schema_doc

@return [Array<SimpleType>]

return object of [SimpleType] contains the name of the simpleType
and array of all existing types. (@see #Schema::SimpleType)
# File lib/soap_enumerator/types/schema.rb, line 54
def get_simple_types(schema_doc)
  search_terms = ['//./xsd:simpleType', '//./s:simpleType', '//./simpleType']
  safe_search(search_terms, schema_doc)&.map do |comp_types_doc|
    Types::Schema::SimpleType.new(comp_types_doc) unless comp_types_doc.nil?
  end.compact
end