Sha256: 1dd7ca5883073b3a3bb7c7a30ebd4eff9d29e88006cd585a2a27d4e1603e0104

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

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

    # Retrieves leagues data for summoner, including leagues for all of summoner's teams
    # @param [String]
    # @return [Array]
    def get *summoner_ids
      returns = {}
      perform_request(api_url("league/by-summoner/#{summoner_ids.join(",")}")).each do |s, l|
        returns[s] = l.map {|data| League.new data}
      end
      returns
    end

    # Retrieves leagues entry data for summoner, including league entries for all of summoner's teams
    # @param [String]
    # @return [Array]
    # TODO: Change name to entries?
    def get_entries summoner_id
      perform_request(api_url("league/by-summoner/#{summoner_id}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves leagues data for team
    # @param [String]
    # @return [Array]
    def by_team team_id
      perform_request(api_url("league/by-team/#{team_id}")).map { |l| League.new l }
    end

    # Retrieves leagues entry data for team
    # @param [String]
    # @return [Array]
    # TODO: Change name to?
    def entries_by_team team_id
      perform_request(api_url("league/by-team/#{team_id}/entry")).map { |e| LeagueEntry.new e }
    end

    # Retrieves challenger tier leagues
    # @return [Array]
    def challenger
      perform_request(api_url('league/challenger')).map { |l| League.new l }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-lol-0.9.18 lib/lol/league_request.rb