Sha256: e3e444c05149bee3450f447c6413f572e8beffb6dc45263481490f83ff776517

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module Lol
  class StatsRequest < Request
    # 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('v1.1', 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 'v1.1', stats_api_path, extra
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-lol-0.9.1 lib/lol/stats_request.rb
ruby-lol-0.0.7 spec/lol/stats_request.rb