lib/xbox_leaders/api.rb in xbox_leaders-1.0.0 vs lib/xbox_leaders/api.rb in xbox_leaders-1.0.1
- old
+ new
@@ -1,12 +1,11 @@
require 'httparty'
class XboxLeaders::Api
include HTTParty
- base_uri 'https://www.xboxleaders.com/api'
- format :json
+ base_uri 'https://www.xboxleaders.com/api/1.0'
attr_accessor :timeout
def initialize(timeout: 6)
@timeout = timeout
@@ -29,13 +28,13 @@
end
private
def get(path, query={})
- response = self.class.get(path, timeout: timeout, query: query).to_hash
+ response = self.class.get(path + ".json", timeout: timeout, query: query).to_hash
- if error = response['error']
- raise ArgumentError, error['message']
+ if error = response['Error']
+ raise ArgumentError, error
end
response['Data']
end