Sha256: 2138020aa01326dbd0b2ef066d292faf8586d4df89065b152a30f37369c84db6

Contents?: true

Size: 1.3 KB

Versions: 10

Compression:

Stored size: 1.3 KB

Contents

module Lol
  class StatsRequest < Request
    # Returns the supported API Version
    # @return [String] the supported api version
    def self.api_version
      "v1.2"
    end

    # Retrieves player statistics summaries for the given summoner
    # @param [String] summoner_id
    # @return [Array] an array of player statistics, one per queue type
    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

    # Retrieves ranked statistics summary for the given summoner
    # @param [String] summoner_id
    # @return [RankedStatisticsSummary] Ranked Stats.
    #   Includes stats for Twisted Treeline and Summoner's Rift
    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

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-lol-0.9.12 lib/lol/stats_request.rb
ruby-lol-0.9.11 lib/lol/stats_request.rb
ruby-lol-0.9.10 lib/lol/stats_request.rb
ruby-lol-0.9.9 lib/lol/stats_request.rb
ruby-lol-0.9.8 lib/lol/stats_request.rb
ruby-lol-0.9.7 lib/lol/stats_request.rb
ruby-lol-0.9.6 lib/lol/stats_request.rb
ruby-lol-0.9.5 lib/lol/stats_request.rb
ruby-lol-0.9.4 lib/lol/stats_request.rb
ruby-lol-0.9.3 lib/lol/stats_request.rb