lib/tumblr/request.rb in tumblr_client-0.6.11 vs lib/tumblr/request.rb in tumblr_client-0.7.0
- old
+ new
@@ -9,16 +9,29 @@
req.url path
req.params = params
end
end
+ # get a redirect url
+ def get_redirect_url(path, params = {})
+ response = get_response path, params
+ if response.status == 301
+ response.headers['Location']
+ else
+ response.body['meta']
+ end
+ end
+
# Performs a get request
def get(path, params={})
respond get_response(path, params)
end
# Performs post request
def post(path, params={})
+ if Array === params[:tags]
+ params[:tags] = params[:tags].join(',')
+ end
response = connection.post do |req|
req.url path
req.body = params unless params.empty?
end
#Check for errors and encapsulate