lib/two_performant/oauth.rb in 2Performant-0.1.1 vs lib/two_performant/oauth.rb in 2Performant-0.1.3
- old
+ new
@@ -9,12 +9,10 @@
end
end
class Net::HTTPGenericRequest
def oauth_body_hash_required?
- puts 'pac oac'
-
return false
end
end
class TwoPerformant
@@ -28,24 +26,24 @@
end
def get(path, params_hash)
params_hash ||= {}
response = access_token.get("#{path}?#{params_hash.to_params}")
- JSON.parse(response.body)
+ (response.body && response.body.size > 0) ? JSON.parse(response.body) : nil
end
def post(path, params_hash)
response = access_token.post(path, params_hash, @headers)
- JSON.parse(response.body)
+ (response.body && response.body.size > 0) ? JSON.parse(response.body) : nil
end
def put(path, params_hash)
response = access_token.put(path, params_hash, @headers)
- JSON.parse(response.body)
+ (response.body && response.body.size > 0) ? JSON.parse(response.body) : nil
end
def delete(path, params)
response = access_token.delete("#{path}?#{params.to_params}")
- JSON.parse(response.body)
+ (response.body && response.body.size > 0) ? JSON.parse(response.body) : nil
end
end
end