Class: ActionWebService::Protocol::Soap::SoapActiveRecordStructFactory
- Inherits:
-
SOAP::Mapping::Factory
- Object
- SOAP::Mapping::Factory
- ActionWebService::Protocol::Soap::SoapActiveRecordStructFactory
- Defined in:
- lib/action_web_service/protocol/soap_protocol/marshaler.rb
Instance Method Summary collapse
Methods inherited from SOAP::Mapping::Factory
#initialize, #setiv2obj, #setiv2soap
Methods included from SOAP::Mapping::TraverseSupport
#mark_marshalled_obj, #mark_unmarshalled_obj
Constructor Details
This class inherits a constructor from SOAP::Mapping::Factory
Instance Method Details
#obj2soap(soap_class, obj, info, map) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/action_web_service/protocol/soap_protocol/marshaler.rb', line 179 def obj2soap(soap_class, obj, info, map) unless obj.is_a?(ActiveRecord::Base) return nil end soap_obj = soap_class.new(obj.class.instance_variable_get('@qname')) obj.class.columns.each do |column| key = column.name.to_s value = obj.send(key) soap_obj[key] = SOAP::Mapping._obj2soap(value, map) end soap_obj end |
#soap2obj(obj_class, node, info, map) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/action_web_service/protocol/soap_protocol/marshaler.rb', line 192 def soap2obj(obj_class, node, info, map) unless node.type == obj_class.instance_variable_get('@qname') return false end obj = obj_class.new node.each do |key, value| obj[key] = value.data end obj.instance_variable_set('@new_record', false) return true, obj end |