Class: RiotAPI::ChampionMastery
- Inherits:
-
Object
- Object
- RiotAPI::ChampionMastery
- Defined in:
- lib/riot_api/resources/champion_mastery.rb
Instance Attribute Summary collapse
-
#champion_id ⇒ Object
Champion ID for this entry.
-
#champion_level ⇒ Object
Champion level for specified player and champion combination.
-
#champion_points ⇒ Object
Total number of champion points for this player and champion combination - they are used to determine championLevel.
-
#champion_points_since_last_level ⇒ Object
Number of points earned since current level has been achieved.
-
#champion_points_until_next_level ⇒ Object
Number of points needed to achieve next level.
-
#chest_granted ⇒ Object
Is chest granted for this champion or not in current season.
-
#last_play_time ⇒ Object
Last time this champion was played by this player - in Unix milliseconds time format.
-
#summoner_id ⇒ Object
Summoner ID for this entry.
-
#tokens_earned ⇒ Object
The token earned for this champion to levelup.
Class Method Summary collapse
-
.find(options = {}) ⇒ RiotAPI::ChampionMastery
Finds the summoner mastery for a specific champion.
- .from_json(json) ⇒ Object
-
.score_sum(options = {}) ⇒ Integer
Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
-
.where(options = {}) ⇒ Array<RiotAPI::ChampionMastery>
Finds all champion mastery information for a specific summoner.
Instance Attribute Details
#champion_id ⇒ Object
Champion ID for this entry.
13 14 15 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 13 def champion_id @champion_id end |
#champion_level ⇒ Object
Champion level for specified player and champion combination.
7 8 9 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 7 def champion_level @champion_level end |
#champion_points ⇒ Object
Total number of champion points for this player and champion combination - they are used to determine championLevel.
10 11 12 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 10 def champion_points @champion_points end |
#champion_points_since_last_level ⇒ Object
Number of points earned since current level has been achieved.
25 26 27 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 25 def champion_points_since_last_level @champion_points_since_last_level end |
#champion_points_until_next_level ⇒ Object
Number of points needed to achieve next level. Zero if player reached maximum champion level for this champion.
16 17 18 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 16 def champion_points_until_next_level @champion_points_until_next_level end |
#chest_granted ⇒ Object
Is chest granted for this champion or not in current season.
4 5 6 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 4 def chest_granted @chest_granted end |
#last_play_time ⇒ Object
Last time this champion was played by this player - in Unix milliseconds time format.
19 20 21 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 19 def last_play_time @last_play_time end |
#summoner_id ⇒ Object
Summoner ID for this entry. (Encrypted)
28 29 30 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 28 def summoner_id @summoner_id end |
#tokens_earned ⇒ Object
The token earned for this champion to levelup.
22 23 24 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 22 def tokens_earned @tokens_earned end |
Class Method Details
.find(options = {}) ⇒ RiotAPI::ChampionMastery
Finds the summoner mastery for a specific champion.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 38 def self.find( = {}) = [:region, :summoner_id, :champion_id] unless ( - .keys).empty? raise ArgumentError, "A required parameter was not informed. The required paramaters are #{mandatory_options}" end request_url = "/lol/champion-mastery/v4/champion-masteries/by-summoner/#{options[:summoner_id]}/by-champion/#{options[:champion_id]}" response = RiotAPI.client.request(:get, request_url, [:region]) self.from_json(response) end |
.from_json(json) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 85 def self.from_json(json) self.new.tap do |s| s.chest_granted = json["chestGranted"] s.champion_level = json["championLevel"] s.champion_points = json["championPoints"] s.champion_id = json["championId"] s.champion_points_until_next_level = json["championPointsUntilNextLevel"] s.last_play_time = json["lastPlayTime"] s.tokens_earned = json["tokensEarned"] s.champion_points_since_last_level = json["championPointsSinceLastLevel"] s.summoner_id = json["summonerId"] end end |
.score_sum(options = {}) ⇒ Integer
Get a player's total champion mastery score, which is the sum of individual champion mastery levels.
75 76 77 78 79 80 81 82 83 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 75 def self.score_sum( = {}) = [:region, :summoner_id] unless ( - .keys).empty? raise ArgumentError, "A required parameter was not informed. The required paramaters are #{mandatory_options}" end request_url = "/lol/champion-mastery/v4/scores/by-summoner/#{options[:summoner_id]}" response = RiotAPI.client.request(:get, request_url, [:region]) end |
.where(options = {}) ⇒ Array<RiotAPI::ChampionMastery>
Finds all champion mastery information for a specific summoner.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/riot_api/resources/champion_mastery.rb', line 56 def self.where( = {}) = [:region, :summoner_id] unless ( - .keys).empty? raise ArgumentError, "A required parameter was not informed. The required paramaters are #{mandatory_options}" end request_url = "/lol/champion-mastery/v4/champion-masteries/by-summoner/#{options[:summoner_id]}" response = RiotAPI.client.request(:get, request_url, [:region]) response.map { |raw| self.from_json(raw) } end |