Sha256: b6086550559f8d5a7ae9242dc1b85e727c5cb42fdfb1df33c6624c3e2123cad3

Contents?: true

Size: 1.99 KB

Versions: 128

Compression:

Stored size: 1.99 KB

Contents

# Sportradar Football

![API Reference](https://developer.sportradar.com/files/indexFootball.html)

## NFL

Get started with official NFL api v1:

```ruby
nfl = Sportradar::Api::Football::Nfl.new
nfl = Sportradar::Api::Football::Nfl.new(year: 2016)
res = nfl.get_schedule          # => res is the raw response data hash. the `nfl` object now has weeks present to interact with
res = nfl.get_weekly_schedule   # => res is the raw response data hash. the `nfl` object now has weeks present to interact with
nfl.weeks.count                 # => 17
nfl.games.count                 # => 256
nfl.weeks.first.games.count     # => 16
game = nfl.games.sample         # => Sportradar::Api::Football::Nfl::Game
res = game.get_pbp              # => res is raw response data hash. the `game` object now has quarters/drives/plays to interact with
game.quarters.size              # => 4 (unless the game went to overtime)
game.drives.size                # => (20-30) most NFL games have between 20 and 30 drives
game.plays.size                 # => 150 most NFL games have about 150 total plays

game.get_statistics             # => res is raw response data hash. the `game` object now has team stats to interact with
game.home.stats.passing         # => Sportradar::Api::Football::StatPack::Passing => passing stats
game.home.stats.passing.players.first
```


```ruby
nfl = Marshal.load(File.binread('nfl.bin'));
ncaafb = Marshal.load(File.binread('ncaafb.bin'));
g1 = nfl.games.sample;
g2 = ncaafb.games.sample
g2.year
g1.year
games = [g1, g2]
games.map(&:year)
games.map(&:week)
games.map(&:week_number)
g1
g1.year
g1.week_number
games.map(&:type)
games.map(&:path_pbp)
games.map(&:plays)
games.map(&:drives).map(&:count)
games.map(&:plays).map(&:count)
games.map(&:quarter)
games.map(&:score)
games.each(&:get_statistics);
games.each(&:get_box);
games.map(&:score)
games.each(&:get_pbp);
games.map(&:plays).map(&:count)
games.map(&:drives).map(&:count)


uri = '2015/REG/1/WKY/MSH'
game = Sportradar::Api::Football::Ncaafb::Game.new('uri' => uri)
```


Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.11.68 lib/sportradar/api/football/README.md
sportradar-api-0.11.67 lib/sportradar/api/football/README.md
sportradar-api-0.11.66 lib/sportradar/api/football/README.md
sportradar-api-0.11.65 lib/sportradar/api/football/README.md
sportradar-api-0.11.64 lib/sportradar/api/football/README.md
sportradar-api-0.11.63 lib/sportradar/api/football/README.md
sportradar-api-0.11.62 lib/sportradar/api/football/README.md
sportradar-api-0.11.61 lib/sportradar/api/football/README.md
sportradar-api-0.11.60 lib/sportradar/api/football/README.md
sportradar-api-0.11.59 lib/sportradar/api/football/README.md
sportradar-api-0.11.58 lib/sportradar/api/football/README.md
sportradar-api-0.11.57 lib/sportradar/api/football/README.md
sportradar-api-0.11.56 lib/sportradar/api/football/README.md
sportradar-api-0.11.55 lib/sportradar/api/football/README.md
sportradar-api-0.11.54 lib/sportradar/api/football/README.md
sportradar-api-0.11.53 lib/sportradar/api/football/README.md
sportradar-api-0.11.52 lib/sportradar/api/football/README.md
sportradar-api-0.11.51 lib/sportradar/api/football/README.md
sportradar-api-0.11.50 lib/sportradar/api/football/README.md
sportradar-api-0.11.49 lib/sportradar/api/football/README.md