Class: SOAP::Mapping::Factory

Inherits:
Object
  • Object
show all
Includes:
TraverseSupport
Defined in:
lib/soap/mapping/factory.rb

Instance Method Summary collapse

Methods included from TraverseSupport

#mark_marshalled_obj, #mark_unmarshalled_obj

Constructor Details

#initializeFactory

Returns a new instance of Factory.



16
17
18
# File 'lib/soap/mapping/factory.rb', line 16

def initialize
  # nothing to do
end

Instance Method Details

#obj2soap(soap_class, obj, info, map) ⇒ Object

Raises:

  • (NotImplementError)


20
21
22
23
# File 'lib/soap/mapping/factory.rb', line 20

def obj2soap(soap_class, obj, info, map)
  raise NotImplementError.new
  # return soap_obj
end

#setiv2obj(obj, node, map) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/soap/mapping/factory.rb', line 30

def setiv2obj(obj, node, map)
  return if node.nil?
  if obj.is_a?(Array)
    setiv2ary(obj, node, map)
  else
    setiv2struct(obj, node, map)
  end
end

#setiv2soap(node, obj, map) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/soap/mapping/factory.rb', line 39

def setiv2soap(node, obj, map)
  if obj.class.class_variables.include?('@@schema_element')
    obj.class.class_eval('@@schema_element').each do |name, info|
      type, qname = info
      if qname
        elename = qname.name
      else
        elename = Mapping.name2elename(name)
      end
      node.add(elename,
        Mapping._obj2soap(obj.instance_variable_get('@' + name), map))
    end
  else
    # should we sort instance_variables?
    obj.instance_variables.each do |var|
      name = var.sub(/^@/, '')
      elename = Mapping.name2elename(name)
      node.add(elename,
        Mapping._obj2soap(obj.instance_variable_get(var), map))
    end
  end
end

#soap2obj(obj_class, node, info, map) ⇒ Object

Raises:

  • (NotImplementError)


25
26
27
28
# File 'lib/soap/mapping/factory.rb', line 25

def soap2obj(obj_class, node, info, map)
  raise NotImplementError.new
  # return convert_succeeded_or_not, obj
end