Permalink
Browse files

Switched json and xml deserializers to json gem and included ToHashPa…

…rser#from_xml
  • Loading branch information...
1 parent 057e3f1 commit c0ad5dece3d15f8549f5292ad678c7b18a939ccb @jnunemaker committed Dec 7, 2008
Showing with 8 additions and 5 deletions.
  1. +4 −1 lib/httparty.rb
  2. +2 −2 lib/httparty/request.rb
  3. +2 −2 lib/httparty/xml.rb
View
@@ -3,6 +3,8 @@
require 'net/http'
require 'net/https'
require 'rubygems'
+gem 'json', '>= 1.1.3'
+require 'json'
require 'active_support'
require 'module_level_inheritable_attributes'
@@ -96,4 +98,5 @@ def self.delete(*args)
end
require 'httparty/exceptions'
-require 'httparty/request'
+require 'httparty/request'
+require 'httparty/xml'
View
@@ -104,9 +104,9 @@ def parse_response(body) #:nodoc:
return nil if body.nil? or body.empty?
case format
when :xml
- Hash.from_xml(body)
+ ToHashParser.from_xml(body)
when :json
- ActiveSupport::JSON.decode(body)
+ JSON.parse(body)
else
body
end
View
@@ -198,8 +198,8 @@ def to_s
end
end
-class HashFromXml
- def self.create(xml)
+class ToHashParser
+ def self.from_xml(xml)
stack = []
parser = REXML::Parsers::BaseParser.new(xml)

0 comments on commit c0ad5de

Please sign in to comment.