class LolSoap::WSDLParser::Type

Public Class Methods

new(*params) click to toggle source
Calls superclass method LolSoap::WSDLParser::Node::new
# File lib/lolsoap/wsdl_parser.rb, line 113
def initialize(*params)
  super(*params)

  @namespace, @name = parser.namespace_and_name(node, node.attr('name').to_s, target_namespace)
end

Public Instance Methods

attributes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 123
def attributes
  parent_attributes + own_attributes
end
base_type() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 127
def base_type
  @base_type ||= begin
    if extension = node.at_xpath('*/xs:extension', parser.ns)
      parser.type(*parser.namespace_and_name(extension, extension.attribute('base').to_s))
    end
  end
end
elements() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 119
def elements
  parent_elements.merge(own_elements)
end

Private Instance Methods

defined_attributes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 173
def defined_attributes
  node.xpath('xs:attribute/@name | */xs:extension/xs:attribute/@name', parser.ns).map(&:text)
end
element_nodes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 153
def element_nodes
  node.xpath('*/xs:element | */*/xs:element | xs:complexContent/xs:extension/*/xs:element | xs:complexContent/xs:extension/*/*/xs:element', parser.ns).map { |el|
    element = TypeElement.new(parser, schema, el)

    if reference = el.attribute('ref')
      ReferencedElement.new(element, parser.element(*parser.namespace_and_name(el, reference.to_s)))
    else
      element
    end
  }
end
own_attributes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 169
def own_attributes
  defined_attributes + referenced_attributes
end
own_elements() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 137
def own_elements
  Hash[
    element_nodes.map do |element|
      [
        element.name,
        {
          :name      => element.name,
          :namespace => element.namespace,
          :type      => element.type,
          :singular  => element.singular
        }
      ]
    end
  ]
end
parent_attributes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 183
def parent_attributes
  base_type ? base_type.attributes : []
end
parent_elements() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 165
def parent_elements
  base_type ? base_type.elements : {}
end
referenced_attributes() click to toggle source
# File lib/lolsoap/wsdl_parser.rb, line 177
def referenced_attributes
  node.xpath('xs:attributeGroup[@ref] | */xs:extension/xs:attributeGroup[@ref]', parser.ns).map { |group|
    parser.attribute_group(*parser.namespace_and_name(group, group.attribute('ref').to_s))
  }.flat_map(&:attributes)
end