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.



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

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

Instance Attribute Details

#elenameObject (readonly)

Returns the value of attribute elename.



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

def elename
  @elename
end

#encodingstyleObject (readonly)

Returns the value of attribute encodingstyle.



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

def encodingstyle
  @encodingstyle
end

#mustunderstandObject

Returns the value of attribute mustunderstand.



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

def mustunderstand
  @mustunderstand
end

#target_actorObject (readonly)

Returns the value of attribute target_actor.



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

def target_actor
  @target_actor
end

Instance Method Details

#on_inbound(header, mustunderstand = false) ⇒ Object

Given header is a SOAPHeaderItem or nil.



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

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

#on_inbound_headeritem(header, item) ⇒ Object



55
56
57
# File 'lib/soap/header/handler.rb', line 55

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

#on_outboundObject

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



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

def on_outbound
  nil
end

#on_outbound_headeritem(header) ⇒ Object



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

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
  else
    item.elename = @elename
    ::SOAP::SOAPHeaderItem.new(item, @mustunderstand, @encodingstyle,
      @target_actor)
  end
end