Permalink
Browse files

Fixed JSON Parsing; switched faraday_stack to faraday_middleware

  • Loading branch information...
1 parent 0f54380 commit c864cdcaef07f782b65e06b961fada3dfe6e12b2 @bvass bvass committed Apr 16, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/tumblr/connection.rb
  2. +2 −2 lib/tumblr/request.rb
@@ -1,5 +1,5 @@
require 'faraday'
-require 'faraday_stack'
+require 'faraday_middleware'
require 'tumblr/request/oauth'
module Tumblr
@@ -13,9 +13,9 @@ def connection(options={})
:url => "http://api.tumblr.com/"
}
Faraday.new("http://api.tumblr.com/", default_options.merge(options)) do |builder|
- builder.use FaradayStack::ResponseJSON, content_type: "application/json"
builder.use Tumblr::Request::TumblrOAuth, Tumblr::credentials if not Tumblr::credentials.empty?
builder.use Faraday::Request::UrlEncoded
+ builder.use FaradayMiddleware::ParseJson, :content_type => "application/json"
builder.use Faraday::Adapter::NetHttp
end
end
@@ -10,7 +10,7 @@ def get(path, params={})
req.params = params
end
#check for errors and encapsulate
- JSON.parse(response.body)['response']
+ response.body['response']
end
#Performs post request
@@ -20,7 +20,7 @@ def post(path, params={})
req.body = params unless params.empty?
end
#Check for errors and encapsulate
- JSON.parse(response.body)['response']
+ response.body['response']
end
end
end

0 comments on commit c864cdc

Please sign in to comment.