Skip to content

A Ruby interface to the Sports Data API. API supports NFL, MLB, NHL, and NBA.

License

Notifications You must be signed in to change notification settings

toplinegamelabs/sports_data_api

 
 

Repository files navigation

SportsDataApi Build Status Coverage Status

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.

Author

Ryan Lovelett ( @rlovelett )

Drop me a message for any questions, suggestions, requests, bugs or submit them to the issue log.

API Support

Installation

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

Usage

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.

Testing

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:

  1. Delete all the cassettes (rm spec/cassettes/*.yml)
  2. Run specs passing the API key as environment variable (SPORTS_DATA_<NBA|NFL>_API_KEY=realapikey bundle exec rake spec)

Contributing

  1. Fork it
  2. Create a topic branch (git checkout -b topic)
  3. Make your changes
  4. Squash your changes into one commit
  5. Create new Pull Request against this squashed commit

About

A Ruby interface to the Sports Data API. API supports NFL, MLB, NHL, and NBA.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%