Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

In Files

  • soap/mapping/factory.rb

Class/Module Index [+]

Quicksearch

SOAP::Mapping::HashFactory_

Public Class Methods

new(allow_original_mapping = false) click to toggle source
 
               # File soap/mapping/factory.rb, line 304
def initialize(allow_original_mapping = false)
  super()
  @allow_original_mapping = allow_original_mapping
end
            

Public Instance Methods

obj2soap(soap_class, obj, info, map) click to toggle source
 
               # File soap/mapping/factory.rb, line 309
def obj2soap(soap_class, obj, info, map)
  if !@allow_original_mapping and !obj.instance_variables.empty?
    return nil
  end
  if !obj.default.nil? or
      (obj.respond_to?(:default_proc) and obj.default_proc)
    return nil
  end
  soap_obj = SOAPStruct.new(MapQName)
  mark_marshalled_obj(obj, soap_obj)
  obj.each do |key, value|
    elem = SOAPStruct.new
    elem.add("key", Mapping._obj2soap(key, map))
    elem.add("value", Mapping._obj2soap(value, map))
    # ApacheAxis allows only 'item' here.
    soap_obj.add("item", elem)
  end
  soap_obj
end
            
soap2obj(obj_class, node, info, map) click to toggle source
 
               # File soap/mapping/factory.rb, line 329
def soap2obj(obj_class, node, info, map)
  unless node.type == MapQName
    return false
  end
  if node.class == SOAPStruct and node.key?('default')
    return false
  end
  obj = Mapping.create_empty_object(obj_class)
  mark_unmarshalled_obj(node, obj)
  if node.class == SOAPStruct
    node.each do |key, value|
      obj[Mapping._soap2obj(value['key'], map)] =
        Mapping._soap2obj(value['value'], map)
    end
  else
    node.each do |value|
      obj[Mapping._soap2obj(value['key'], map)] =
        Mapping._soap2obj(value['value'], map)
    end
  end
  return true, obj
end