Sha256: e183d2c14c1a383a64add241b8d7c07c00e44b1dbcfdddd440e390534768b13e

Contents?: true

Size: 1.41 KB

Versions: 20

Compression:

Stored size: 1.41 KB

Contents

require_relative 'base'
require 'addressable/template'
module Taric
  module Operation
    module Champion
      include Taric::Operation::Base

      CHAMPION_VERSION = 'v1.2'.freeze
      CHAMPION_BASE_URL = "#{BASE_URL_FN.(CHAMPION_VERSION)}/champion"

      CHAMPIONS =  Addressable::Template.new("#{CHAMPION_BASE_URL}{?api_key,freeToPlay}")
      CHAMPION_BY_ID = Addressable::Template.new("#{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

20 entries across 20 versions & 1 rubygems

Version Path
taric-0.4.0 lib/taric/operation/champion.rb
taric-0.3.4 lib/taric/operation/champion.rb
taric-0.3.3 lib/taric/operation/champion.rb
taric-0.3.1 lib/taric/operation/champion.rb
taric-0.3.0 lib/taric/operation/champion.rb
taric-0.2.4 lib/taric/operation/champion.rb
taric-0.2.2 lib/taric/operation/champion.rb
taric-0.2.1 lib/taric/operation/champion.rb
taric-0.2.0 lib/taric/operation/champion.rb
taric-0.1.14 lib/taric/operation/champion.rb
taric-0.1.13 lib/taric/operation/champion.rb
taric-0.1.12 lib/taric/operation/champion.rb
taric-0.1.11 lib/taric/operation/champion.rb
taric-0.1.10 lib/taric/operation/champion.rb
taric-0.1.9 lib/taric/operation/champion.rb
taric-0.1.8 lib/taric/operation/champion.rb
taric-0.1.7 lib/taric/operation/champion.rb
taric-0.1.6 lib/taric/operation/champion.rb
taric-0.1.5 lib/taric/operation/champion.rb
taric-0.1.4 lib/taric/operation/champion.rb