Sha256: 608b1dcdf40953f8a50958d38ea526f2fd3cc6c12e3e5fde44502ab399eabe36

Contents?: true

Size: 953 Bytes

Versions: 4

Compression:

Stored size: 953 Bytes

Contents

module Lol
  # Bindings for the Champion API.
  #
  # See: https://developer.riotgames.com/api-methods/#champion-v3
  class ChampionRequest < Request
    # Retrieve all champions
    #
    # See: https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampions
    # @param free_to_play [Boolean] filter param to retrieve only free to play champions
    # @return [Array<Lol::DynamicModel>] an array of champions
    def all free_to_play: false
      result = perform_request api_url("champions", "freeToPlay" => free_to_play)
      result["champions"].map { |c| DynamicModel.new c }
    end

    # Retrieve champion by ID
    #
    # See: https://developer.riotgames.com/api-methods/#champion-v3/GET_getChampionsById
    # @param id [Integer] id of the champion to get
    # @return [Lol::DynamicModel] the found champion
    def find id
      result = perform_request api_url "champions/#{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_request.rb
ruby-lol-1.1.2 lib/lol/champion_request.rb
ruby-lol-1.1.1 lib/lol/champion_request.rb
ruby-lol-1.0.0 lib/lol/champion_request.rb