Class: WSDL::Parser::Service Private

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl/parser/service.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.

Represents a WSDL service element.

A service groups a set of related ports together. Each port defines a single endpoint that combines a binding with a network address. Services are the top-level entry point for discovering available endpoints in a WSDL document.

API:

  • private

Instance Method Summary collapse

Constructor Details

#initialize(service_node) ⇒ 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.

Creates a new Service from a WSDL service XML node.

Parameters:

  • the wsdl:service element

API:

  • private



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

def initialize(service_node)
  @service_node = service_node
end

Instance Method Details

#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 name of this service.

Returns:

  • the service name

API:

  • private



25
26
27
# File 'lib/wsdl/parser/service.rb', line 25

def name
  @service_node['name']
end

#portsHash{String => 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 the ports defined in this service.

Returns:

  • a hash of port names to port objects

API:

  • private



32
33
34
# File 'lib/wsdl/parser/service.rb', line 32

def ports
  @ports ||= ports!
end

#to_hashHash

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.

Converts this service to a Hash representation.

Examples:

service.to_hash
# => { "ServiceName" => {
#        ports: {
#          "PortName" => { type: "...", location: "..." }
#        }
#      }
#    }

Returns:

  • a hash with the service name as key and ports as values

API:

  • private



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

def to_hash
  port_hash = ports.values.inject({}) { |memo, port| memo.merge port.to_hash }
  { name => { ports: port_hash } }
end