handlers/mantis_project_create_v1/handler/vendor/savon-0.8.6/lib/savon/core_ext/hash.rb
# Maps keys and values of a Hash created from SOAP response XML to more convenient Ruby Objects.
Maps keys and values of a Hash created from SOAP response XML to more convenient Ruby Objects.
Maps keys and values of a Hash created from SOAP response XML to more convenient Ruby Objects .
def map_soap_response
        inject({}) do |hash, (key, value)|
          value = case value
            when ::Hash   then value["xsi:nil"] ? nil : value.map_soap_response
            when ::Array  then value.map { |val| val.map_soap_response rescue val }
            when ::String then value.map_soap_response
          end
          new_key = if Savon.strip_namespaces?
            key.strip_namespace.snakecase.to_sym
          else
            key.snakecase
          end
          if hash[new_key] 
            hash[new_key] = [hash[new_key], value].flatten
            result = hash
          else
            result = hash.merge new_key => value
          end
          result
        end
      end
def map_soap_response inject ( { } ) do | hash , ( key , value ) | value = case value when :: Hash then value [ "xsi:nil" ] ? nil : value . map_soap_response when :: Array then value . map { | val | val . map_soap_response rescue val } when :: String then value . map_soap_response end new_key = if Savon . strip_namespaces? key . strip_namespace . snakecase . to_sym else key . snakecase end if hash [ new_key ] hash [ new_key ] = [ hash [ new_key ] , value ] . flatten result = hash else result = hash . merge new_key => value end result end end
Maps keys and values of a Hash created from SOAP response XML to more convenient Ruby Objects.
Maps keys and values of a Hash created from SOAP response XML to more convenient Ruby Objects .
# key already exists, value should be added as an Array