lib/ppds/tumblr.rb in grumblr-2.1.1 vs lib/ppds/tumblr.rb in grumblr-2.2.0
- old
+ new
@@ -52,13 +52,14 @@
self.user = nil
self.blogs = []
end
def query(action, data)
- RestClient.post(API_URL + action, data)
- rescue RestClient::RequestFailed
- raise 'Query failed: %s' % $!
+ raise 'Cannot authenticate without credentials' unless data[:email] and data[:password]
+ RestClient.post(API_URL + action, data) { |response| response.body }
+ rescue RestClient::RequestFailed => e
+ raise 'Query failed: %s' % e.response.body
rescue RestClient::RequestTimeout
raise 'Timeout occured'
rescue Exception
raise $!
end
@@ -76,10 +77,11 @@
Blog.new(node.attributes)
end
true
- rescue Exception
+ rescue Exception => e
+ puts e
false
end
end
end