Sha256: 181730764a4f301fc5e47b2fcbf38f4ce195dc833550b7a6166a498fcdcabf47

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require_relative 'base'
require_relative 'endpoint_template'
module Taric
  module Operation
    module Champion
      include Taric::Operation::Base

      CHAMPION_BASE_URL = "https://{host}/lol/platform/v3/champions"

      CHAMPIONS =  EndpointTemplate.new(template_url: "#{CHAMPION_BASE_URL}{?api_key,freeToPlay}")
      CHAMPION_BY_ID = EndpointTemplate.new(template_url: "#{CHAMPION_BASE_URL}/{id}{?api_key}")

      # Returns champion data.
      #
      # @see https://developer.riotgames.com/api/methods#!/958/3290
      # @param free_to_play [Boolean] optional, nil returns all, true or false to filter if they're free to play or not
      # @return [Hash] embedding [Array] of champions keyed off of "champions"
      #
      # @example
      #   all_champions = client.champions["champions"]
      #   free_champions = client.champions(free_to_play: true)["champions"]
      #   nonfree_champions = client.champions(free_to_play: false)["champions"]
      def champions(free_to_play: nil)
        response_for CHAMPIONS, freeToPlay: free_to_play
      end

      # Returns champion data by id.
      #
      # @see https://developer.riotgames.com/api/methods#!/958/3289
      # @param id [Fixnum] id of champion
      # @return [Hash] of champion data
      #
      # @example
      #   champion = client.champion(id: 266)
      def champion(id:)
        response_for CHAMPION_BY_ID, id: id
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
taric-1.0.0.pre.beta.0 lib/taric/operation/champion.rb
taric-1.0.0.pre.alpha.8 lib/taric/operation/champion.rb
taric-1.0.0.pre.alpha.6 lib/taric/operation/champion.rb
taric-1.0.0.pre.alpha.4 lib/taric/operation/champion.rb
taric-1.0.0.pre.alpha.3 lib/taric/operation/champion.rb
taric-1.0.0.pre.alpha.2 lib/taric/operation/champion.rb