class RiotAPI::Champion
This class represents a champion in League of Legends. It contains data about the champion.
Public Class Methods
all(free=false)
click to toggle source
Returns all the champions in the game For only the free to play champions, set ‘free` to true
# File lib/riot_api/champion.rb, line 16 def self.all(free=false) champs_json = RiotAPI::Client.get('na', 'champion', { freeToPlay: free }) champs_json["champions"].map do |c| Champion.new(c) end end
free_to_play_champions()
click to toggle source
Returns all the free to play champions in the game
# File lib/riot_api/champion.rb, line 24 def self.free_to_play_champions all(true) end
new(data)
click to toggle source
Creates a new Champion
described by the JSON data returned from the API
# File lib/riot_api/champion.rb, line 6 def initialize(data) data.each do |key, value| key = key.underscore self.class.send(:attr_accessor, key.to_sym) instance_variable_set("@#{key}", value) end end