Class: Lol::ChampionMasteryRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/lol/champion_mastery_request.rb

Overview

Bindings for the Champion Mastery API.

See: developer.riotgames.com/api-methods/#champion-mastery-v3

Instance Attribute Summary

Attributes inherited from Request

#api_key, #cache_store, #rate_limiter, #region

Instance Method Summary collapse

Methods inherited from Request

#api_base_url, #api_query_string, #api_url, api_version, #api_version, #cached?, #clean_url, #initialize, #perform_rate_limited_request, #perform_request, #perform_uncached_request, #platform, platforms, #store, #ttl

Constructor Details

This class inherits a constructor from Lol::Request

Instance Method Details

#all(summoner_id:) ⇒ Array<Lol::DynamicModel>

Get all champion mastery entries sorted by number of champion points descending

See: developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getAllChampionMasteries

Parameters:

  • summoner_id (Integer)

    Summoner ID associated with the player

Returns:


25
26
27
28
# File 'lib/lol/champion_mastery_request.rb', line 25

def all summoner_id:
  result = perform_request api_url "champion-masteries/by-summoner/#{summoner_id}"
  result.map { |c| DynamicModel.new c }
end

#find(champion_id, summoner_id:) ⇒ Lol::DynamicModel

Get a champion mastery by player ID and champion ID

See: developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getDynamicModel

Parameters:

  • summoner_id (Integer)

    Summoner ID associated with the player

Returns:


35
36
37
38
# File 'lib/lol/champion_mastery_request.rb', line 35

def find champion_id, summoner_id:
  result = perform_request api_url "champion-masteries/by-summoner/#{summoner_id}/by-champion/#{champion_id}"
  DynamicModel.new result
end

#total_score(summoner_id:) ⇒ Integer

Get a player's total champion mastery score, which is the sum of individual champion mastery levels

See: developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getDynamicModelScore

Parameters:

  • summoner_id (Integer)

    Summoner ID associated with the player

Returns:

  • (Integer)

    Player's total champion master score


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

def total_score summoner_id:
  perform_request api_url "scores/by-summoner/#{summoner_id}"
end