added ratelimit exception
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
require 'sightstone/champion'
|
||||
require 'sightstone/modules/sightstone_base_module'
|
||||
|
||||
class ChampionModule
|
||||
class ChampionModule < SightstoneBaseModule
|
||||
|
||||
def initialize(sightstone)
|
||||
@sightstone = sightstone
|
||||
@@ -20,28 +21,4 @@ class ChampionModule
|
||||
return champions
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
def _get_api_response(uri, headers={})
|
||||
params = {'api_key' => @sightstone.api_key}.merge headers
|
||||
RestClient.get(uri, headers={:params => params}) {|response, request, result| response }
|
||||
rescue SocketError => e
|
||||
nil
|
||||
|
||||
end
|
||||
|
||||
def _parse_response(response, &block)
|
||||
response_code = if response.nil?
|
||||
500
|
||||
else
|
||||
response.code
|
||||
end
|
||||
|
||||
if response_code == 200
|
||||
block.call(response.body)
|
||||
elsif response_code == 500
|
||||
raise Sightstone::SightstoneConnectionException
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user