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.48 lib/sportradar/api/football/README.md
sportradar-api-0.11.47 lib/sportradar/api/football/README.md
sportradar-api-0.11.46 lib/sportradar/api/football/README.md
sportradar-api-0.11.45 lib/sportradar/api/football/README.md
sportradar-api-0.11.44 lib/sportradar/api/football/README.md
sportradar-api-0.11.43 lib/sportradar/api/football/README.md
sportradar-api-0.11.42 lib/sportradar/api/football/README.md
sportradar-api-0.11.41 lib/sportradar/api/football/README.md
sportradar-api-0.11.40 lib/sportradar/api/football/README.md
sportradar-api-0.11.39 lib/sportradar/api/football/README.md
sportradar-api-0.11.38 lib/sportradar/api/football/README.md
sportradar-api-0.11.37 lib/sportradar/api/football/README.md
sportradar-api-0.11.36 lib/sportradar/api/football/README.md
sportradar-api-0.11.35 lib/sportradar/api/football/README.md
sportradar-api-0.11.34 lib/sportradar/api/football/README.md
sportradar-api-0.11.33 lib/sportradar/api/football/README.md
sportradar-api-0.11.32 lib/sportradar/api/football/README.md
sportradar-api-0.11.31 lib/sportradar/api/football/README.md
sportradar-api-0.11.30 lib/sportradar/api/football/README.md
sportradar-api-0.11.29 lib/sportradar/api/football/README.md