Module: SportsDataApi::Nfl
- Extended by:
- Request
- Defined in:
- lib/sports_data_api/nfl.rb,
lib/sports_data_api/nfl/game.rb,
lib/sports_data_api/nfl/team.rb,
lib/sports_data_api/nfl/week.rb,
lib/sports_data_api/nfl/drive.rb,
lib/sports_data_api/nfl/event.rb,
lib/sports_data_api/nfl/games.rb,
lib/sports_data_api/nfl/teams.rb,
lib/sports_data_api/nfl/venue.rb,
lib/sports_data_api/nfl/action.rb,
lib/sports_data_api/nfl/player.rb,
lib/sports_data_api/nfl/season.rb,
lib/sports_data_api/nfl/actions.rb,
lib/sports_data_api/nfl/quarter.rb,
lib/sports_data_api/nfl/weather.rb,
lib/sports_data_api/nfl/injuries.rb,
lib/sports_data_api/nfl/quarters.rb,
lib/sports_data_api/nfl/broadcast.rb,
lib/sports_data_api/nfl/play_action.rb,
lib/sports_data_api/nfl/team_roster.rb,
lib/sports_data_api/nfl/event_action.rb,
lib/sports_data_api/nfl/play_by_play.rb,
lib/sports_data_api/nfl/play_by_plays.rb,
lib/sports_data_api/nfl/team_season_stats.rb,
lib/sports_data_api/nfl/player_season_stats.rb
Defined Under Namespace
Classes: Actions, Broadcast, Drive, Event, EventAction, Exception, Game, Games, Injuries, PlayAction, PlayByPlay, PlayByPlays, Player, PlayerSeasonStats, Quarter, Quarters, Season, Team, TeamRoster, TeamSeasonStats, Teams, Venue, Weather, Week
Constant Summary collapse
- API_VERSION =
1- BASE_URL =
'https://api.sportsdatallc.org/nfl-%{access_level}%{version}'- DIR =
File.join(File.dirname(__FILE__), 'nfl')
- SPORT =
:nfl
Class Method Summary collapse
-
.boxscore(year, season, week, home, away) ⇒ Object
Fetches NFL boxscore for a given game.
-
.game_roster(year, season, week, home, away) ⇒ Object
Fetches roster for a given NFL game.
-
.game_statistics(year, season, week, home, away) ⇒ Object
Fetches statistics for a given NFL game.
-
.play_by_play(year, season, week, home, away) ⇒ Object
Fetches NFL play by play for a given year, season and week.
-
.player_season_stats(team, year, season) ⇒ Object
Fetch NFL player seaon stats for a given team, season and season type.
-
.schedule(year, season) ⇒ Object
Fetches NFL season schedule for a given year and season.
-
.team_roster(team) ⇒ Object
Fetch NFL team roster.
-
.team_season_stats(team, year, season) ⇒ Object
Fetch NFL team seaon stats for a given team, season and season type.
-
.teams ⇒ Object
Fetches all NFL teams.
-
.weekly(year, season, week) ⇒ Object
Fetches NFL weekly schedule for a given year, season and week.
Methods included from Request
response_json, response_xml, response_xml_xpath
Class Method Details
.boxscore(year, season, week, home, away) ⇒ Object
Fetches NFL boxscore for a given game
63 64 65 66 |
# File 'lib/sports_data_api/nfl.rb', line 63 def boxscore(year, season, week, home, away) response = get("/#{year}/%{season}/#{week}/#{away}/#{home}/boxscore.json", season) Game.new(year, season, week, response) end |
.game_roster(year, season, week, home, away) ⇒ Object
Fetches roster for a given NFL game
75 76 77 78 |
# File 'lib/sports_data_api/nfl.rb', line 75 def game_roster(year, season, week, home, away) response = get("/#{year}/%{season}/#{week}/#{away}/#{home}/roster.json", season) Game.new(year, season, week, response) end |
.game_statistics(year, season, week, home, away) ⇒ Object
Fetches statistics for a given NFL game
69 70 71 72 |
# File 'lib/sports_data_api/nfl.rb', line 69 def game_statistics(year, season, week, home, away) response = get("/#{year}/%{season}/#{week}/#{away}/#{home}/statistics.json", season) Game.new(year, season, week, response) end |
.play_by_play(year, season, week, home, away) ⇒ Object
Fetches NFL play by play for a given year, season and week
92 93 94 95 |
# File 'lib/sports_data_api/nfl.rb', line 92 def play_by_play(year, season, week, home, away) response = get("/#{year}/%{season}/#{week}/#{away}/#{home}/pbp.json", season) PlayByPlay.new(year, season, week, response) end |
.player_season_stats(team, year, season) ⇒ Object
Fetch NFL player seaon stats for a given team, season and season type
57 58 59 60 |
# File 'lib/sports_data_api/nfl.rb', line 57 def player_season_stats(team, year, season) response = get("/teams/#{team}/#{year}/%{season}/statistics.json", season) PlayerSeasonStats.new(response) end |
.schedule(year, season) ⇒ Object
Fetches NFL season schedule for a given year and season
39 40 41 42 |
# File 'lib/sports_data_api/nfl.rb', line 39 def schedule(year, season) response = get("/#{year}/%{season}/schedule.json", season) Season.new(response) end |
.team_roster(team) ⇒ Object
Fetch NFL team roster
45 46 47 48 |
# File 'lib/sports_data_api/nfl.rb', line 45 def team_roster(team) response = response_json("/teams/#{team}/roster.json") TeamRoster.new(response) end |
.team_season_stats(team, year, season) ⇒ Object
Fetch NFL team seaon stats for a given team, season and season type
51 52 53 54 |
# File 'lib/sports_data_api/nfl.rb', line 51 def team_season_stats(team, year, season) response = get("/teams/#{team}/#{year}/%{season}/statistics.json", season) TeamSeasonStats.new(response) end |
.teams ⇒ Object
Fetches all NFL teams
81 82 83 |
# File 'lib/sports_data_api/nfl.rb', line 81 def teams Teams.new(response_json('/teams/hierarchy.json')) end |
.weekly(year, season, week) ⇒ Object
Fetches NFL weekly schedule for a given year, season and week
86 87 88 89 |
# File 'lib/sports_data_api/nfl.rb', line 86 def weekly(year, season, week) response = get("/#{year}/%{season}/#{week}/schedule.json", season) Games.new(year, season, week, response) end |