Class: LolSoap::Envelope

Inherits:
Object
  • Object
show all
Defined in:
lib/lolsoap/envelope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wsdl, operation, doc = Nokogiri::XML::Document.new) ⇒ Envelope

Returns a new instance of Envelope.



14
15
16
17
18
19
20
# File 'lib/lolsoap/envelope.rb', line 14

def initialize(wsdl, operation, doc = Nokogiri::XML::Document.new)
  @wsdl      = wsdl
  @operation = operation
  @doc       = doc

  initialize_doc
end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



6
7
8
# File 'lib/lolsoap/envelope.rb', line 6

def doc
  @doc
end

#operationObject (readonly)

Returns the value of attribute operation.



6
7
8
# File 'lib/lolsoap/envelope.rb', line 6

def operation
  @operation
end

#wsdlObject (readonly)

Returns the value of attribute wsdl.



6
7
8
# File 'lib/lolsoap/envelope.rb', line 6

def wsdl
  @wsdl
end

Instance Method Details

#actionObject



45
46
47
# File 'lib/lolsoap/envelope.rb', line 45

def action
  operation.action
end

#body(klass = Builder) {|builder| ... } ⇒ Object

Build the body of the envelope

Examples:

env.body do |b|
  b.some 'data'
end

Yields:

  • (builder)


28
29
30
31
32
# File 'lib/lolsoap/envelope.rb', line 28

def body(klass = Builder)
  builder = klass.new(body_content, input_body_content_type)
  yield builder if block_given?
  builder
end

#endpointObject



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

def endpoint
  wsdl.endpoint
end

#header(klass = Builder) {|builder| ... } ⇒ Object

Build the header of the envelope

Yields:

  • (builder)


35
36
37
38
39
# File 'lib/lolsoap/envelope.rb', line 35

def header(klass = Builder)
  builder = klass.new(header_content, input_header_content_type)
  yield builder if block_given?
  builder
end

#inputObject



49
50
51
# File 'lib/lolsoap/envelope.rb', line 49

def input
  operation.input
end

#input_bodyObject



65
66
67
# File 'lib/lolsoap/envelope.rb', line 65

def input_body
  input.body
end

#input_body_contentObject



69
70
71
# File 'lib/lolsoap/envelope.rb', line 69

def input_body_content
  input_body.content
end

#input_body_content_typeObject



73
74
75
# File 'lib/lolsoap/envelope.rb', line 73

def input_body_content_type
  input_body.content_type
end

#input_headerObject



53
54
55
# File 'lib/lolsoap/envelope.rb', line 53

def input_header
  input.header
end

#input_header_contentObject



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

def input_header_content
  input_header.content
end

#input_header_content_typeObject



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

def input_header_content_type
  input_header.content_type
end

#outputObject



77
78
79
# File 'lib/lolsoap/envelope.rb', line 77

def output
  operation.output
end

#output_bodyObject



89
90
91
# File 'lib/lolsoap/envelope.rb', line 89

def output_body
  output.body
end

#output_body_contentObject



93
94
95
# File 'lib/lolsoap/envelope.rb', line 93

def output_body_content
  output_body.content
end

#output_body_content_typeObject



97
98
99
# File 'lib/lolsoap/envelope.rb', line 97

def output_body_content_type
  output_body.content_type
end

#output_headerObject



81
82
83
# File 'lib/lolsoap/envelope.rb', line 81

def output_header
  output.header
end

#output_header_typeObject



85
86
87
# File 'lib/lolsoap/envelope.rb', line 85

def output_header_type
  output_header && output_header.type
end

#soap_namespaceObject



109
110
111
# File 'lib/lolsoap/envelope.rb', line 109

def soap_namespace
  soap_version == '1.2' ? SOAP_1_2 : SOAP_1_1
end

#soap_prefixObject



105
106
107
# File 'lib/lolsoap/envelope.rb', line 105

def soap_prefix
  'soap'
end

#soap_versionObject



113
114
115
# File 'lib/lolsoap/envelope.rb', line 113

def soap_version
  wsdl.soap_version
end

#to_xml(options = {}) ⇒ Object



101
102
103
# File 'lib/lolsoap/envelope.rb', line 101

def to_xml(options = {})
  doc.to_xml(options)
end