Skip to content

Commit

Permalink
nfl simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
phoffer committed Jul 11, 2017
1 parent 227d2a7 commit ba43e21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,11 @@ boxscore = sim.match_boxscore(sim.simulation_match)

### NFL

It's possible to find the current simulation game:
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.

```
Sportradar::Api::Nfl.new('o').active_simulation
=>
https://api.sportradar.us/nfl-sim1/games/f45b4a31-b009-4039-8394-42efbc6d5532/boxscore.xml
Live Game: Green Bay Packers vs Minnesota Vikings. Q2 00:08. game_id='f45b4a31-b009-4039-8394-42efbc6d5532'
Sportradar::Api::Football::Nfl.simulations # => returns array of simulation games. Only 1 is inprogress at a time
Sportradar::Api::Football::Nfl.simulation # => returns Sportradar::Api::Football::Nfl instance with a sim api. useful for mid season stats, standings, etc
```

## Development
Expand Down
13 changes: 13 additions & 0 deletions lib/sportradar/api/football/nfl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,19 @@ def queue_standings
# {url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_venues)}
# end

def self.sim_api
Sportradar::Api::Football::Nfl::Api.new('sim')
end
def self.simulation
new({}, api: sim_api, year: 2015, type: 'reg')
end
def self.simulations
api = sim_api
['f45b4a31-b009-4039-8394-42efbc6d5532', '5a7042cb-fe7a-4838-b93f-6b8c167ec384', '7f761bb5-7963-43ea-a01b-baf4f5d50fe3'].map do |game_id|
Game.new({'id' => game_id}, api: api)
end
end

end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/sportradar/api/football/nfl/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def version
end

def allowed_access_levels
%w[rt p s b t ot]
%w[rt p s b t ot sim]
end

def allowed_seasons
Expand Down

0 comments on commit ba43e21

Please sign in to comment.