SportsDataApi is an attempt to make a Ruby interface to the SportsData API. The goal is to eventaully support the full API. Pull requests that extend the API support are always welcome.
SportsData’s comprehensive data coverage includes all major U.S. sports, plus hundreds of leagues throughout the world. Their live game analysts capture every possible event of every game, in real time and with accuracy standards developed from years of experience.
Drop me a message for any questions, suggestions, requests, bugs or submit them to the issue log.
Add this line to your application's Gemfile:
gem 'sports_data_api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sports_data_api
The specs for this Gem should give you some idea of how to make use of the API. For now they will be the usage information. As always Pull Requests for better documentation are welcome.
The tests for the API have been mocked using VCR and WebMock.
Actual calls to the Sports Data LLC have been mocked out to prevent storage of valid API credentials and making
superflous API calls while testing. As such, in order to generically run the tests (without actually hitting)
the server the only thing that needs to be done is to run the specs (e.g., bundle exec rake spec
or
bundle exec guard start
).
However, if you want to refresh the actual server API responses you will need to re-record all of the VCR cassettes. This can be achieved simply by performing the following two steps:
- Delete all the cassettes (
rm spec/cassettes/*.yml
) - Run specs passing the API key as environment variable (
SPORTS_DATA_<NBA|NFL>_API_KEY=realapikey bundle exec rake spec
)
- Fork it
- Create a topic branch (
git checkout -b topic
) - Make your changes
- Squash your changes into one commit
- Create new Pull Request against this squashed commit