Class: Lol::StatsRequest
Instance Attribute Summary
Attributes inherited from Request
Class Method Summary collapse
-
.api_version ⇒ String
Returns the supported API Version.
Instance Method Summary collapse
-
#ranked(summoner_id, extra = {}) ⇒ RankedStatisticsSummary
Retrieves ranked statistics summary for the given summoner.
-
#summary(summoner_id, extra = {}) ⇒ Array
Retrieves player statistics summaries for the given summoner.
Methods inherited from Request
#api_url, #initialize, #perform_request
Constructor Details
This class inherits a constructor from Lol::Request
Class Method Details
.api_version ⇒ String
Returns the supported API Version
5 6 7 |
# File 'lib/lol/stats_request.rb', line 5 def self.api_version "v1.2" end |
Instance Method Details
#ranked(summoner_id, extra = {}) ⇒ RankedStatisticsSummary
Retrieves ranked statistics summary for the given summoner
26 27 28 29 30 31 32 |
# File 'lib/lol/stats_request.rb', line 26 def ranked summoner_id, extra = {} if extra.keys.select { |k| k.to_sym != :season }.any? raise ArgumentError, 'Only :season is allowed as extra parameter' end stats_api_path = "stats/by-summoner/#{summoner_id}/ranked" RankedStatisticsSummary.new perform_request api_url stats_api_path, extra end |
#summary(summoner_id, extra = {}) ⇒ Array
Retrieves player statistics summaries for the given summoner
12 13 14 15 16 17 18 19 20 |
# File 'lib/lol/stats_request.rb', line 12 def summary summoner_id, extra = {} if extra.keys.select { |k| k.to_sym != :season }.any? raise ArgumentError, 'Only :season is allowed as extra parameter' end stats_api_path = "stats/by-summoner/#{summoner_id}/summary" perform_request(api_url(stats_api_path, extra))['playerStatSummaries'].map do |player_stat_data| PlayerStatistic.new player_stat_data end end |