beneggett/sportradar-api

View on GitHub
README.md

Summary

Maintainability
Test Coverage
[![Gem Version](https://badge.fury.io/rb/sportradar-api.svg)](https://badge.fury.io/rb/sportradar-api)
[![Build Status](https://travis-ci.org/beneggett/sportradar-api.svg?branch=master)](https://travis-ci.org/beneggett/sportradar-api)
[![Code Climate](https://codeclimate.com/github/beneggett/sportradar-api/badges/gpa.svg)](https://codeclimate.com/github/beneggett/sportradar-api)
[![Coverage Status](https://coveralls.io/repos/github/beneggett/sportradar-api/badge.svg?branch=master)](https://coveralls.io/github/beneggett/sportradar-api?branch=master)
[![Dependency Status](https://gemnasium.com/badges/github.com/beneggett/sportradar-api.svg)](https://gemnasium.com/github.com/beneggett/sportradar-api)


# Sportradar API

The SportRadar API extensively covers league & sports data. This gem wraps it up, marshals the data into Ruby Objects we know and love.


Currently (July 2016) the SportRadar API has 23 documented APIs.

Our goal is to incrementally integrate with them. **Contributions are welcome**

## SportRadar APIs

[Current API Versions](http://developer.sportradar.us/api_gallery)

🙋 = Basic API wrapped/object mapping in progress
✅ = API implemented and wrapped in proper objects

| API | Version | Docs | Implemented? | Priority |
| --- | --- | --- | --- | --- |
| NFL | 1 | [📚](http://developer.sportradar.us/page/NFL_Official) | ✅ | 👍 |
| MLB | 6 | [📚](https://developer.sportradar.com/files/indexBaseball.html#major-league-baseball-api-v6) | ✅ | 👍 |
| NHL | 3 | [📚](http://developer.sportradar.us/docs/NHL_API) | - | - |
| NBA | 3 | [📚](http://developer.sportradar.us/docs/NBA_API) | ✅ | 👍 |
| NCAAMB  | 3 | [📚](http://developer.sportradar.us/docs/NCAA_Mens_Basketball) | ✅ | 👍 |
| NCAAFB  | 3 | [📚](http://developer.sportradar.us/docs/NCAA_Football_API) | ✅ | 👍 |
| Golf  | 2 | [📚](http://developer.sportradar.us/docs/Golf_API) | - | - |
| NASCAR  | 3 | [📚](http://developer.sportradar.us/page/NASCAR_Official) | - | - |
| Odds  | 1 | [📚](http://developer.sportradar.us/docs/Odds_API) | 🙋 | 👍 |
| Content | 3 | [📚](http://developer.sportradar.us/docs/Content_API) | ✅ | 👍 |
| Images  | 2 | [📚](http://developer.sportradar.us/docs/Images_API) | ✅ | 👍 |
| Live Images | 1 | [📚](http://developer.sportradar.us/docs/Live_Images_API) | ✅ | 👍 |
| Olympics  | 2 | [📚](http://developer.sportradar.us/docs/Olympics_API_v2) | - | - |
| Soccer  | 2 | [📚](http://developer.sportradar.us/docs/Soccer_API) | ✅️ | 👍 |
| NCAAWB  | 3 | [📚](http://developer.sportradar.us/docs/read/NCAA_Womens_Basketball) | - | - |
| MMA | 1 | [📚](http://developer.sportradar.us/docs/MMA_API) | - | - |
| Cricket   | 1 | [📚](http://developer.sportradar.us/docs/cricket_API) | - | - |
| WNBA  | 3 | [📚](http://developer.sportradar.us/docs/WNBA_API) | - | - |
| NCAAMH  | 3 | [📚](http://developer.sportradar.us/docs/read/NCAA_Mens_Hockey) | - | - |
| NPB | 1 | [📚](http://developer.sportradar.us/docs/NPB_API) | - | - |
| Rugby | 1 | [📚](http://developer.sportradar.us/docs/Rugby_API) | - | - |
| Tennis  | 1 | [📚](http://developer.sportradar.us/docs/Tennis_API) | - | - |
| ESPORTS | 1 | [📚](http://developer.sportradar.us/docs/ESPORTS_API) | - | - |
| Simulation APIs | 1 | [📚](http://developer.sportradar.us/page/Live_Game_Simulation) | ✅ | 👍|

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'sportradar-api'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install sportradar-api

## Usage

TODO: Add some usage instructions.

### Configuration

Manage your ruby environment through `.ruby-version` and `.ruby-gemset` files.

Create `.env` for environment variables. Follow the `.env.sample` for guidance.


## Simulation Games

http://developer.sportradar.us/page/Live_Game_Simulation

### Soccer

```
sim = Sportradar::Api::Soccer.new('na', 't', true)
summary = sim.match_summary(sim.simulation_match)
boxscore = sim.match_boxscore(sim.simulation_match)
```

### Football

It's possible to use simulation games from Sportradar. This allows you to see what data looks like during a game (including non game APIs), useful for development during the offseason.

```
sims = Sportradar::Api::Football::Nfl.simulations # => returns array of simulation games. Only 1 is inprogress at a time
sims.each(&:get_pbp).detect(&:started?)
nfl = Sportradar::Api::Football::Nfl.simulation  # => returns Sportradar::Api::Football::Nfl instance with a sim api. useful for mid season stats, standings, etc

sims = Sportradar::Api::Football::Ncaafb.simulations # => returns array of simulation games. Only 1 is inprogress at a time
sims.each(&:get_pbp).detect(&:started?)
ncaafb = Sportradar::Api::Football::Ncaafb.simulation  # => returns Sportradar::Api::Football::Ncaafb instance with a sim api. useful for mid season stats, standings, etc
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/beneggett/sportradar-api.