Class: SOAP::SOAPHeader
- Inherits:
-
SOAPStruct
- Object
- XSD::NSDBase
- SOAPStruct
- SOAP::SOAPHeader
- Includes:
- SOAPEnvelopeElement
- Defined in:
- lib/soap/element.rb
Constant Summary
Constants included from SOAP
AttrActor, AttrActorName, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, AttrHref, AttrHrefName, AttrId, AttrIdName, AttrMustUnderstand, AttrMustUnderstandName, AttrOffset, AttrOffsetName, AttrPosition, AttrPositionName, AttrRoot, AttrRootName, Base64Literal, EleBody, EleBodyName, EleEnvelope, EleEnvelopeName, EleFault, EleFaultActor, EleFaultActorName, EleFaultCode, EleFaultCodeName, EleFaultDetail, EleFaultDetailName, EleFaultName, EleFaultString, EleFaultStringName, EleHeader, EleHeaderName, EncodingNamespace, EnvelopeNamespace, LiteralNamespace, MediaType, NextActor, PropertyName, SOAPProxy, TypeMap, VERSION, ValueArray, ValueArrayName
Instance Attribute Summary collapse
-
#force_encode ⇒ Object
writeonly
Sets the attribute force_encode.
Attributes included from SOAPCompoundtype
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #force_typed, #id, #parent, #position, #precedents, #root
Attributes inherited from XSD::NSDBase
Instance Method Summary collapse
- #add(name, value) ⇒ Object
- #encode(generator, ns, attrs = {}) ⇒ Object
- #encode? ⇒ Boolean
-
#initialize ⇒ SOAPHeader
constructor
A new instance of SOAPHeader.
- #length ⇒ Object (also: #size)
Methods inherited from SOAPStruct
#[], #[]=, decode, #each, #have_member, #key?, #members, #replace, #to_obj, #to_s
Methods included from SOAPType
Methods included from Enumerable
Methods inherited from XSD::NSDBase
Constructor Details
#initialize ⇒ SOAPHeader
Returns a new instance of SOAPHeader.
197 198 199 200 201 202 |
# File 'lib/soap/element.rb', line 197 def initialize super(nil) @elename = EleHeaderName @encodingstyle = nil @force_encode = false end |
Instance Attribute Details
#force_encode=(value) ⇒ Object (writeonly)
Sets the attribute force_encode
195 196 197 |
# File 'lib/soap/element.rb', line 195 def force_encode=(value) @force_encode = value end |
Instance Method Details
#add(name, value) ⇒ Object
213 214 215 216 217 218 219 220 221 |
# File 'lib/soap/element.rb', line 213 def add(name, value) actor = value.extraattr[AttrActorName] mu = value.extraattr[AttrMustUnderstandName] encstyle = value.extraattr[AttrEncodingStyleName] mu_value = mu.nil? ? nil : (mu == '1') # to remove mustUnderstand attribute, set it to nil item = SOAPHeaderItem.new(value, mu_value, encstyle, actor) super(name, item) end |
#encode(generator, ns, attrs = {}) ⇒ Object
204 205 206 207 208 209 210 211 |
# File 'lib/soap/element.rb', line 204 def encode(generator, ns, attrs = {}) name = ns.name(@elename) generator.encode_tag(name, attrs) @data.each do |data| yield(data) end generator.encode_tag_end(name, @data.size > 0) end |
#encode? ⇒ Boolean
228 229 230 |
# File 'lib/soap/element.rb', line 228 def encode? @force_encode or length > 0 end |
#length ⇒ Object Also known as: size
223 224 225 |
# File 'lib/soap/element.rb', line 223 def length @data.length end |