Module: RiotAPI

Defined in:
lib/riot_api.rb,
lib/riot_api/client.rb,
lib/riot_api/errors.rb,
lib/riot_api/version.rb,
lib/riot_api/resources/summoner.rb,
lib/riot_api/resources/champion_mastery.rb

Defined Under Namespace

Classes: ChampionMastery, Client, ClientNotConfiguredError, InvalidRequestError, ResponseError, Summoner

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.clientRiotAPI::Client

Gets the instance of +RiotAPI::Client+. If the client hasn't been configured yet, it throws a +RiotAPI::ClientNotConfiguredError+.

Returns:



23
24
25
26
27
28
29
# File 'lib/riot_api.rb', line 23

def client
  if @client.nil?
    raise ClientNotConfiguredError, "You must call RiotAPI.configure with your API key before calling the API"
  else
    @client
  end
end

.configure(api_key) ⇒ Object

Sets up the initial configuration for the client to work

Parameters:

  • api_key (String)

    The Riot Games API key



11
12
13
# File 'lib/riot_api.rb', line 11

def configure(api_key)
  @client = Client.new(api_key)
end

.reset!Object

Resets any configuration set by +RiotAPI.configure+



16
17
18
# File 'lib/riot_api.rb', line 16

def reset!
  @client = nil
end