Class: LolSoap::WSDL

Inherits:
Object
  • Object
show all
Defined in:
lib/lolsoap/wsdl.rb,
lib/lolsoap/wsdl/type.rb,
lib/lolsoap/wsdl/element.rb,
lib/lolsoap/wsdl/null_type.rb,
lib/lolsoap/wsdl/operation.rb,
lib/lolsoap/wsdl/null_element.rb,
lib/lolsoap/wsdl/operation_io.rb,
lib/lolsoap/wsdl/operation_io_part.rb,
lib/lolsoap/wsdl/named_type_reference.rb,
lib/lolsoap/wsdl/immediate_type_reference.rb

Defined Under Namespace

Classes: Element, ImmediateTypeReference, NamedTypeReference, NullElement, NullType, Operation, OperationIO, OperationIOPart, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ WSDL

Returns a new instance of WSDL.



32
33
34
35
36
37
38
39
# File 'lib/lolsoap/wsdl.rb', line 32

def initialize(parser)
  @prefixes     = generate_prefixes(parser)
  @namespaces   = prefixes.invert
  @types        = load_types(parser)
  @operations   = load_operations(parser)
  @endpoint     = parser.endpoint
  @soap_version = parser.soap_version
end

Instance Attribute Details

#endpointObject (readonly)

The SOAP endpoint URL



21
22
23
# File 'lib/lolsoap/wsdl.rb', line 21

def endpoint
  @endpoint
end

#namespacesObject (readonly)

Hash of namespaces to generated prefixes



27
28
29
# File 'lib/lolsoap/wsdl.rb', line 27

def namespaces
  @namespaces
end

#prefixesObject (readonly)

Hash of generated prefixes to namespaces



24
25
26
# File 'lib/lolsoap/wsdl.rb', line 24

def prefixes
  @prefixes
end

#soap_versionObject (readonly)

The version of SOAP detected.



30
31
32
# File 'lib/lolsoap/wsdl.rb', line 30

def soap_version
  @soap_version
end

Class Method Details

.parse(raw) ⇒ Object

Create a new instance by parsing a raw string of XML



16
17
18
# File 'lib/lolsoap/wsdl.rb', line 16

def self.parse(raw)
  new(WSDLParser.parse(raw))
end

Instance Method Details

#inspectObject



66
67
68
69
70
71
# File 'lib/lolsoap/wsdl.rb', line 66

def inspect
  "<#{self.class} " \
  "namespaces=#{namespaces.inspect} " \
  "operations=#{operations.inspect} " \
  "types=#{types.inspect}>"
end

#operation(name) ⇒ Object

Get a single operation



57
58
59
# File 'lib/lolsoap/wsdl.rb', line 57

def operation(name)
  @operations.fetch(name)
end

#operationsObject

Hash of operations that are supported by the SOAP service



52
53
54
# File 'lib/lolsoap/wsdl.rb', line 52

def operations
  Hash[@operations.values.map { |o| [o.name, o] }]
end

#prefix(namespace) ⇒ Object

Get the prefix for a namespace



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

def prefix(namespace)
  prefixes.fetch namespace
end

#type(namespace, name) ⇒ Object

Get a single type, or a NullType if the type doesn’t exist



47
48
49
# File 'lib/lolsoap/wsdl.rb', line 47

def type(namespace, name)
  @types.fetch([namespace, name]) { NullType.new }
end

#typesObject

Hash of types declared by the service



42
43
44
# File 'lib/lolsoap/wsdl.rb', line 42

def types
  Hash[@types.values.map { |t| [t.name, t] }]
end