class Demacia::Caller

Attributes

api_key[RW]
api_suffix[RW]
entry_point[RW]
region[RW]

Public Class Methods

new(key, region) click to toggle source

Initializes the Caller with an api key (needed) Params:

  • key

    the api key provided by riot

  • region

    the region where the requests have to be made. Can be one of the following : tr,br,na,euw,eune

# File lib/Demacia.rb, line 15
def initialize(key, region)
        @api_key = key
        @region = region
        @api_suffix = "?api_key=" + @api_key
        @entry_point = "http://prod.api.pvp.net/api/lol/" + @region +"/v1.1/"
end

Public Instance Methods

champions() click to toggle source

Gets the list of all league of legends champions Params:

id

The summoner id from riot's api

# File lib/Demacia.rb, line 40
def champions
        
end
summoner_by_id(id) click to toggle source

Gets a summoner's info from riot's API based on its id Params:

id

The summoner id from riot's api

# File lib/Demacia.rb, line 33
def summoner_by_id(id)
        summoner = Demacia::Summoner.new(@entry_point+"summoner/"+id+@api_suffix, @region)
end
summoner_by_name(name) click to toggle source

Gets a summoner's info from riot's API based on its name Params:

  • name

    The summoner name (nickname). NOT the account name

# File lib/Demacia.rb, line 25
def summoner_by_name(name)
        encoded_name = HTMLEntities.new.encode name
        summoner = Demacia::Summoner.new(@entry_point+"summoner/by-name/"+encoded_name+@api_suffix, @region)
end