Class: WSDL::Parser::DocumentCollection Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/wsdl/parser/document_collection.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A collection of parsed WSDL documents.

This class aggregates multiple WSDL documents that may be imported from a single root WSDL. It provides unified access to messages, port types, bindings, and services across all imported documents.

Instance Method Summary collapse

Constructor Details

#initializeDocumentCollection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new empty DocumentCollection.



17
18
19
20
# File 'lib/wsdl/parser/document_collection.rb', line 17

def initialize
  @documents = []
  @sealed = false
end

Instance Method Details

#<<(document) ⇒ Array<Document>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds a document to the collection.

Parameters:

  • document (Document)

    the document to add

Returns:

  • (Array<Document>)

    the updated documents array

Raises:



27
28
29
30
31
32
33
34
# File 'lib/wsdl/parser/document_collection.rb', line 27

def <<(document)
  if sealed?
    raise SealedCollectionError,
          'Cannot add documents after import has completed and the collection is sealed.'
  end

  @documents << document
end

#bindingsHash{QName => Binding}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns all bindings from all documents in the collection.

Returns:

  • (Hash{QName => Binding})

    a merged hash of all bindings keyed by qualified name



69
70
71
# File 'lib/wsdl/parser/document_collection.rb', line 69

def bindings
  @bindings ||= collect_sections(:binding, &:bindings)
end

#each {|document| ... } ⇒ Enumerator, Array

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Iterates over each document in the collection.

Yields:

  • (document)

    yields each document

Yield Parameters:

  • document (Document)

    a document in the collection

Returns:

  • (Enumerator, Array)

    an enumerator if no block given, otherwise the documents array



41
42
43
# File 'lib/wsdl/parser/document_collection.rb', line 41

def each(&)
  @documents.each(&)
end

#messagesHash{QName => MessageInfo}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns all messages from all documents in the collection.

Returns:

  • (Hash{QName => MessageInfo})

    a merged hash of all messages keyed by qualified name



55
56
57
# File 'lib/wsdl/parser/document_collection.rb', line 55

def messages
  @messages ||= collect_sections(:message, &:messages)
end

#port_typesHash{QName => PortType}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns all port types from all documents in the collection.

Returns:

  • (Hash{QName => PortType})

    a merged hash of all port types keyed by qualified name



62
63
64
# File 'lib/wsdl/parser/document_collection.rb', line 62

def port_types
  @port_types ||= collect_sections(:port_type, &:port_types)
end

#seal!DocumentCollection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Seals this collection against further mutation.

Returns:



94
95
96
97
# File 'lib/wsdl/parser/document_collection.rb', line 94

def seal!
  @sealed = true
  self
end

#sealed?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns whether this collection is sealed against mutation.

Returns:

  • (Boolean)

    true when sealed



102
103
104
# File 'lib/wsdl/parser/document_collection.rb', line 102

def sealed?
  @sealed
end

#service_nameString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the service name from the first (root) document.

Returns:

  • (String)

    the service name



48
49
50
# File 'lib/wsdl/parser/document_collection.rb', line 48

def service_name
  @service_name ||= first.service_name
end

#service_port(service_name, port_name) ⇒ Port

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a port by service and port name.

Parameters:

  • service_name (String)

    the name of the service

  • port_name (String)

    the name of the port

Returns:

  • (Port)

    the port object

Raises:

  • (KeyError)

    if the service or port is not found



86
87
88
89
# File 'lib/wsdl/parser/document_collection.rb', line 86

def service_port(service_name, port_name)
  service = services.fetch(service_name)
  service.ports.fetch(port_name)
end

#servicesHash{String => Service}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns all services from all documents in the collection.

Returns:

  • (Hash{String => Service})

    a merged hash of all services keyed by name



76
77
78
# File 'lib/wsdl/parser/document_collection.rb', line 76

def services
  @services ||= collect_sections(:service, &:services)
end