lib/tumblr/request.rb in tumblr_client-0.6.8 vs lib/tumblr/request.rb in tumblr_client-0.6.9
- old
+ new
@@ -1,21 +1,24 @@
require 'json'
module Tumblr
module Request
- #Performs a get request
- def get(path, params={})
- response = connection.get do |req|
- req.url path
+ # Perform a get request and return the raw response
+ def get_response(path, params = {})
+ connection.get do |req|
+ req.url path
req.params = params
end
- #Check for errors and encapsulate
- respond(response)
end
-
- #Performs post request
+
+ # Performs a get request
+ def get(path, params={})
+ respond get_response(path, params)
+ end
+
+ # Performs post request
def post(path, params={})
response = connection.post do |req|
req.url path
req.body = params unless params.empty?
end
@@ -28,8 +31,8 @@
response.body['response']
else
response.body['meta']
end
end
-
+
end
end