
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
The sports_api
gem provides a convenient Ruby interface to interact with the api-sports.io sports statistics, live scores, and predictions API. It allows developers to easily integrate sports data into their Ruby applications with minimal effort.
It currently supports the V3 of api-sports.io.
The best starting point is the Sports API Website, with its introduction and explanation.
Add this line to your application's Gemfile:
gem 'sports_api', github: "Sanchezdav/sports_api"
And then execute:
$ bundle
Or install it yourself as:
$ gem install sports_api
To access the API, you'll need to create a client and pass in your API key. You can find your API key at https://dashboard.api-football.com/profile, example:
client = SportsApi::Football::Client.new(api_key: ENV["SPORTS_API_KEY"])
The client then gives you access to each of the resources.
The gem maps as closely as we can to the Sports API so you can easily convert API examples to gem code.
Responses are created as objects like SportsApi::Football::League
. They're built using OpenStruct so you can easily access data in a Ruby-ish way.
client.coaches.list(search: 'Tuchel')
client.coaches.find(id: 40)
client.countries.list
client.countries.list(search: "Mex")
client.countries.find_by_code(code: "MX")
client.countries.find_by_name(name: "Mexico")
client.fixtures.list(live: "all", league: 262)
client.fixtures.find(id: 1187546)
client.fixture_rounds.list(league: 262, season: 2023)
client.fixture_head_to_head.list(h2h: "2287-2278")
client.fixture_statistics.list(fixture: '463')
client.fixture_events.list(fixture: '215662')
client.fixture_lineups.list(fixture: '592872')
client.fixture_player_statistics.list(fixture: '169080', team: 2284)
client.injuries.list(fixture: '686314')
client.leagues.list
client.leagues.list(code: "MX", season: 2023)
client.leagues.find(id: 262)
client.league_seasons.list
client.odds.list(fixture: '326090', bookmaker: 6)
client.odds_bets.list(search: 'under')
client.odds_bets.find(id: 1)
client.odds_bookmakers.list
client.odds_bookmakers.find(id: 8)
client.odds_lives.list(fixture: '721238')
client.odds_live_bets.list
client.odds_live_bets.find(id: 1)
client.odds_mappings.list
client.players.list(team: 2287, season: 2023)
client.players.list(id: 35603, season: 2023)
client.player_seasons.list
client.player_seasons.list(player: 276)
client.player_squads.list(team: 33)
client.player_top_assists.list(league: 262, season: 2023)
client.player_top_scorers.list(league: 262, season: 2023)
client.player_top_red_cards.list(league: 262, season: 2023)
client.player_top_yellow_cards.list(league: 262, season: 2023)
client.predictions.list(fixture: '198772')
client.sidelined.list(player: 35603)
client.standings.list(season: 2023, team: 2287)
client.teams.list
client.teams.list(country: "Mexico")
client.teams.find(id: 2287)
client.team_countries.list
client.team_statistics.find(league: 39, team: 33, season: 2019)
client.team_seasons.list(team: 2287)
client.timezones.list
client.transfers.list(team: 2287)
client.trophies.list(player: 35603)
client.venues.list(search: "Mex")
client.venues.find(id: 556)
After checking out the repo, run bin/setup
to install dependencies. You can also run bin/console
for an interactive prompt that will allow you to experiment, for example:
# Create your client
client = SportsApi::Football::Client.new(api_key: ENV["SPORTS_API_KEY"])
# List all leagues
client.leagues.list
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.
To run the documentation site locally you have to run docsify serve docs
and you can check all the content within the ./docs
folder.
Bug reports and pull requests are welcome on GitHub at https://github.com/Sanchezdav/sports_api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the SportsApi project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that sports_api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.