./lib/ews/transaction/mapping.rb in exact4r-0.8 vs ./lib/ews/transaction/mapping.rb in exact4r-0.9

- old
+ new

@@ -156,21 +156,22 @@ # parses xml response elements into the response attributes def self.response_xml_string_to_hash(response, root) root.elements.to_a.each do |node| gwlib_prop_name = XML_RESPONSE_TAGS_TO_ATTRS[node.name.to_sym] unless gwlib_prop_name.nil? - # todo: should notiy this somehow?? - value = (ATTR_FORMATS.include?(gwlib_prop_name)) ? node.text.send("to_#{ATTR_FORMATS[gwlib_prop_name]}") : node.text + value = case gwlib_prop_name + when :transaction_approved, :transaction_error + (node.text == "true") ? 1 : 0 + when :transaction_tag + node.text.to_i + else + node.text + end + response.send "#{gwlib_prop_name}=", value end end end - - # type-conversion from strings for certain attributes - ATTR_FORMATS = { - :transaction_tag => "i", - :transaction_approved => "i" - } REQUEST_ENVELOPE_NAMESPACES = { "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", "xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance" \ No newline at end of file