A Ruby gem for fetching League of Legends professional team roster data from the Leaguepedia API. Query team rosters, player information, and filter by region and year.
- Query teams by region (LCK, LPL, LEC, LTA)
- Get current or historical team rosters
- Filter rosters by year
- Retrieve detailed player information including:
- In-game name (IGN)
- Real name
- Country
- Role (position)
- Contract dates (start and end)
- Substitute/trainee status
- Both Ruby library API and command-line interface (CLI)
Add this line to your application's Gemfile:
gem 'lol_roster_data'And then execute:
bundle installOr install it yourself as:
gem install lol_roster_data# List all LCK teams
lol_roster_data teams --region LCK
# List all LPL teams
lol_roster_data teams --region LPL
# Output as JSON
lol_roster_data teams --region LEC --format json# Get current roster for T1
lol_roster_data roster T1
# Get T1's roster from 2024
lol_roster_data roster T1 --year 2024
# Get Gen.G's 2023 roster as JSON
lol_roster_data roster "Gen.G" --year 2023 --format json
# Other examples
lol_roster_data roster DK --year 2022
lol_roster_data roster KTlol_roster_data versionrequire 'lol_roster_data'
# Get all LCK teams
teams = LolRosterData::Team.all(region: 'LCK')
teams.each do |team|
puts "#{team.name} (#{team.short_name})"
puts " Region: #{team.region}"
puts " Location: #{team.location}"
end# Get current roster for T1
players = LolRosterData::Roster.current('T1')
players.each do |player|
puts "#{player.ign} - #{player.role}"
puts " Real Name: #{player.real_name}"
puts " Country: #{player.country}"
puts " Contract: #{player.contract_start} to #{player.contract_end || 'Present'}"
puts " Substitute: #{player.is_substitute}"
end# Get T1's 2024 roster
players = LolRosterData::Roster.for_team('T1', year: 2024)
# Filter only starters (exclude substitutes)
starters = players.reject(&:is_substitute)
# Check if a player was active in 2024
faker = players.find { |p| p.ign == 'Faker' }
puts "Faker was active in 2024" if faker&.active_in_year?(2024)player = LolRosterData::Player.new(
ign: 'Faker',
real_name: 'Lee Sang-hyeok',
country: 'South Korea',
role: 'Mid',
contract_start: '2013-02-01',
contract_end: nil
)
# Check if player is currently active
puts player.active? # true (no end date)
# Check if player was active in a specific year
puts player.active_in_year?(2024) # true
# Convert to hash
puts player.to_h
# => {
# ign: "Faker",
# real_name: "Lee Sang-hyeok",
# country: "South Korea",
# role: "Mid",
# contract_start: "2013-02-01",
# contract_end: nil,
# is_substitute: false
# }- LCK - League of Legends Champions Korea
- LPL - League of Legends Pro League (China)
- LEC - League of Legends EMEA Championship (Europe)
- LTA - Liga Latinoamérica (Latin America)
All data is retrieved from Leaguepedia, the comprehensive League of Legends esports wiki, via their Cargo API.
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lol_roster_data.