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/named_type_reference.rb,
lib/lolsoap/wsdl/immediate_type_reference.rb

Defined Under Namespace

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser) ⇒ WSDL

Returns a new instance of WSDL.



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

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



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

def endpoint
  @endpoint
end

#namespacesObject (readonly)

Hash of namespaces to generated prefixes



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

def namespaces
  @namespaces
end

#prefixesObject (readonly)

Hash of generated prefixes to namespaces



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

def prefixes
  @prefixes
end

#soap_versionObject (readonly)

The version of SOAP detected.



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

def soap_version
  @soap_version
end

Class Method Details

.parse(raw) ⇒ Object

Create a new instance by parsing a raw string of XML



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

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

Instance Method Details

#inspectObject



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

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

#operation(name) ⇒ Object

Get a single operation



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

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

#operationsObject

Hash of operations that are supported by the SOAP service



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

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

#prefix(namespace) ⇒ Object

Get the prefix for a namespace



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

def prefix(namespace)
  prefixes.fetch namespace
end

#type(namespace, name) ⇒ Object

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



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

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

#typesObject

Hash of types declared by the service



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

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