Sha256: a9ab808a46ab963fefc9708932170ba7e8c044832696e52e4fdbb59821dbf464

Contents?: true

Size: 1.67 KB

Versions: 4

Compression:

Stored size: 1.67 KB

Contents

module Lol
  # Bindings for the Champion Mastery API.
  #
  # See: https://developer.riotgames.com/api-methods/#champion-mastery-v3
  class ChampionMasteryRequest < Request
    # @!visibility private
    def api_base_path
      "/lol/champion-mastery/#{api_version}"
    end

    # Get a player's total champion mastery score, which is the sum of individual champion mastery levels
    #
    # See: https://developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getDynamicModelScore
    # @param [Integer] summoner_id Summoner ID associated with the player
    # @return [Integer] Player's total champion master score
    def total_score summoner_id:
      perform_request api_url "scores/by-summoner/#{summoner_id}"
    end

    # Get all champion mastery entries sorted by number of champion points descending
    #
    # See: https://developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getAllChampionMasteries
    # @param [Integer] summoner_id Summoner ID associated with the player
    # @return [Array<Lol::DynamicModel>] Champion Masteries
    def all summoner_id:
      result = perform_request api_url "champion-masteries/by-summoner/#{summoner_id}"
      result.map { |c| DynamicModel.new c }
    end

    # Get a champion mastery by player ID and champion ID
    #
    # See: https://developer.riotgames.com/api-methods/#champion-mastery-v3/GET_getDynamicModel
    # @param [Integer] summoner_id Summoner ID associated with the player
    # @return [Lol::DynamicModel] Champion Mastery
    def find champion_id, summoner_id:
      result = perform_request api_url "champion-masteries/by-summoner/#{summoner_id}/by-champion/#{champion_id}"
      DynamicModel.new result
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-lol-1.2.0 lib/lol/champion_mastery_request.rb
ruby-lol-1.1.2 lib/lol/champion_mastery_request.rb
ruby-lol-1.1.1 lib/lol/champion_mastery_request.rb
ruby-lol-1.0.0 lib/lol/champion_mastery_request.rb