Class: SOAP::SOAPStruct
Overview
Constant Summary
Constants included
from SOAP
AttrActor, AttrArrayType, AttrArrayTypeName, AttrEncodingStyle, AttrEncodingStyleName, 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, SOAPNamespaceTag, TypeMap, VERSION, ValueArray, ValueArrayName, XSDNamespaceTag, XSINamespaceTag
Instance Attribute Summary
Attributes included from SOAPType
#definedtype, #elename, #encodingstyle, #extraattr, #id, #parent, #position, #precedents, #root
Attributes inherited from XSD::NSDBase
#type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from SOAPType
#inspect, #rootnode
inherited, #init, types
Constructor Details
#initialize(type = nil) ⇒ SOAPStruct
Returns a new instance of SOAPStruct.
400
401
402
403
404
405
|
# File 'lib/action_web_service/soap/baseData.rb', line 400
def initialize(type = nil)
super()
@type = type || XSD::QName::EMPTY
@array = []
@data = []
end
|
Class Method Details
.decode(elename, type) ⇒ Object
486
487
488
489
490
|
# File 'lib/action_web_service/soap/baseData.rb', line 486
def self.decode(elename, type)
s = SOAPStruct.new(type)
s.elename = elename
s
end
|
Instance Method Details
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
# File 'lib/action_web_service/soap/baseData.rb', line 419
def [](idx)
if idx.is_a?(Range)
@data[idx]
elsif idx.is_a?(Integer)
if (idx > @array.size)
raise ArrayIndexOutOfBoundsError.new('In ' << @type.name)
end
@data[idx]
else
if @array.include?(idx)
@data[@array.index(idx)]
else
nil
end
end
end
|
#[]=(idx, data) ⇒ Object
436
437
438
439
440
441
442
443
|
# File 'lib/action_web_service/soap/baseData.rb', line 436
def []=(idx, data)
if @array.include?(idx)
data.parent = self if data.respond_to?(:parent=)
@data[@array.index(idx)] = data
else
add(idx, data)
end
end
|
#add(name, value) ⇒ Object
415
416
417
|
# File 'lib/action_web_service/soap/baseData.rb', line 415
def add(name, value)
add_member(name, value)
end
|
472
473
474
475
476
477
478
|
# File 'lib/action_web_service/soap/baseData.rb', line 472
def each
idx = 0
while idx < @array.length
yield(@array[idx], @data[idx])
idx += 1
end
end
|
#key?(name) ⇒ Boolean
445
446
447
|
# File 'lib/action_web_service/soap/baseData.rb', line 445
def key?(name)
@array.include?(name)
end
|
449
450
451
|
# File 'lib/action_web_service/soap/baseData.rb', line 449
def members
@array
end
|
480
481
482
483
484
|
# File 'lib/action_web_service/soap/baseData.rb', line 480
def replace
members.each do |member|
self[member] = yield(self[member])
end
end
|
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
|
# File 'lib/action_web_service/soap/baseData.rb', line 453
def to_obj
hash = {}
proptype = {}
each do |k, v|
value = v.respond_to?(:to_obj) ? v.to_obj : v.to_s
case proptype[k]
when :single
hash[k] = [hash[k], value]
proptype[k] = :multi
when :multi
hash[k] << value
else
hash[k] = value
proptype[k] = :single
end
end
hash
end
|
407
408
409
410
411
412
413
|
# File 'lib/action_web_service/soap/baseData.rb', line 407
def to_s()
str = ''
self.each do |key, data|
str << "#{key}: #{data}\n"
end
str
end
|