def typecast_value value, type
      case type
      when *STRINGLIKE_TYPES
        value.to_s
      when :boolean
        !['false','0','f'].include? value.to_s.downcase
      when :int
        value.to_i
      when :double, :percent
        value.to_f
      when :date
        Date.parse value
      when :datetime
        DateTime.parse value
      else
        value
      end
    end
def typecast_value value, type
      case type
      when *STRINGLIKE_TYPES
        value.to_s
      when :boolean
        !['false','0','f'].include? value.to_s.downcase
      when :int
        value.to_i
      when :double, :percent
        value.to_f
      when :date
        Date.parse value
      when :datetime
        DateTime.parse value
      else
        value
      end
    end
Handles Salesforce FieldTypes as described here:
 http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describesobjects_describesobjectresult.htm#i1427700