lib/lol/request.rb in ruby-lol-0.9.11 vs lib/lol/request.rb in ruby-lol-0.9.12
- old
+ new
@@ -38,18 +38,18 @@
# Calls the API via HTTParty and handles errors
# @param url [String] the url to call
# @return [String] raw response of the call
def perform_request url
if cached? && result = store.get(url)
- return result
+ return JSON.parse(result)
end
response = self.class.get(url)
raise NotFound.new("404 Not Found") if response.respond_to?(:code) && response.not_found?
raise InvalidAPIResponse.new(response["status"]["message"]) if response.is_a?(Hash) && response["status"]
if cached?
- store.set url, response
+ store.set url, response.to_json
store.expire url, ttl
end
response
end