Class: SOAP::Header::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/soap/header/handler.rb

Direct Known Subclasses

MappingHandler, SimpleHandler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elename) ⇒ Handler

Returns a new instance of Handler.



22
23
24
25
26
27
# File 'lib/soap/header/handler.rb', line 22

def initialize(elename)
  @elename = elename
  @mustunderstand = false
  @encodingstyle = nil
  @target_actor = nil
end

Instance Attribute Details

#elenameObject (readonly)

Returns the value of attribute elename.



17
18
19
# File 'lib/soap/header/handler.rb', line 17

def elename
  @elename
end

#encodingstyleObject (readonly)

Returns the value of attribute encodingstyle.



19
20
21
# File 'lib/soap/header/handler.rb', line 19

def encodingstyle
  @encodingstyle
end

#mustunderstandObject

Returns the value of attribute mustunderstand.



18
19
20
# File 'lib/soap/header/handler.rb', line 18

def mustunderstand
  @mustunderstand
end

#target_actorObject (readonly)

Returns the value of attribute target_actor.



20
21
22
# File 'lib/soap/header/handler.rb', line 20

def target_actor
  @target_actor
end

Instance Method Details

#on_inbound(header, mustunderstand = false) ⇒ Object

Given header is a SOAPHeaderItem or nil.



35
36
37
# File 'lib/soap/header/handler.rb', line 35

def on_inbound(header, mustunderstand = false)
  # do something.
end

#on_inbound_headeritem(header, item) ⇒ Object



57
58
59
# File 'lib/soap/header/handler.rb', line 57

def on_inbound_headeritem(header, item)
  on_inbound(item.element, item.mustunderstand)
end

#on_outboundObject

Should return a SOAP/OM, a SOAPHeaderItem or nil.



30
31
32
# File 'lib/soap/header/handler.rb', line 30

def on_outbound
  nil
end

#on_outbound_headeritem(header) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/soap/header/handler.rb', line 39

def on_outbound_headeritem(header)
  arity = self.method(:on_outbound).arity
  item = (arity == 0) ? on_outbound : on_outbound(header)
  if item.nil?
    nil
  elsif item.is_a?(::SOAP::SOAPHeaderItem)
    item.elename = @elename
    item
  elsif item.is_a?(::SOAP::SOAPElement)
    item.elename = @elename
    item
  else
    item.elename = @elename
    ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle,
      @target_actor)
  end
end