Module: SportsDataApi::Ncaafb

Extended by:
Request
Defined in:
lib/sports_data_api/ncaafb.rb,
lib/sports_data_api/ncaafb/game.rb,
lib/sports_data_api/ncaafb/team.rb,
lib/sports_data_api/ncaafb/week.rb,
lib/sports_data_api/ncaafb/drive.rb,
lib/sports_data_api/ncaafb/event.rb,
lib/sports_data_api/ncaafb/games.rb,
lib/sports_data_api/ncaafb/polls.rb,
lib/sports_data_api/ncaafb/teams.rb,
lib/sports_data_api/ncaafb/venue.rb,
lib/sports_data_api/ncaafb/action.rb,
lib/sports_data_api/ncaafb/player.rb,
lib/sports_data_api/ncaafb/season.rb,
lib/sports_data_api/ncaafb/actions.rb,
lib/sports_data_api/ncaafb/quarter.rb,
lib/sports_data_api/ncaafb/weather.rb,
lib/sports_data_api/ncaafb/division.rb,
lib/sports_data_api/ncaafb/injuries.rb,
lib/sports_data_api/ncaafb/quarters.rb,
lib/sports_data_api/ncaafb/broadcast.rb,
lib/sports_data_api/ncaafb/poll_team.rb,
lib/sports_data_api/ncaafb/play_action.rb,
lib/sports_data_api/ncaafb/team_roster.rb,
lib/sports_data_api/ncaafb/event_action.rb,
lib/sports_data_api/ncaafb/play_by_play.rb,
lib/sports_data_api/ncaafb/play_by_plays.rb

Defined Under Namespace

Classes: Actions, Broadcast, Division, Drive, Event, EventAction, Exception, Game, Games, Injuries, PlayAction, PlayByPlay, PlayByPlays, Player, PollTeam, Polls, Quarter, Quarters, Season, Team, TeamRoster, Teams, Venue, Weather, Week

Constant Summary collapse

API_VERSION =
1
BASE_URL =
'https://api.sportsdatallc.org/ncaafb-%{access_level}%{version}'
DIR =
File.join(File.dirname(__FILE__), 'ncaafb')
SPORT =
:ncaafb

Class Method Summary collapse

Methods included from Request

response_json, response_xml, response_xml_xpath

Class Method Details

.boxscore(year, season, week, home, away) ⇒ Object

Fetches Ncaafb boxscore for a given game



56
57
58
59
60
61
# File 'lib/sports_data_api/ncaafb.rb', line 56

def boxscore(year, season, week, home, away)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/#{week}/#{away}/#{home}/boxscore.json")

  Game.new(year, season, week, response)
end

.game_roster(year, season, week, home, away) ⇒ Object

Fetches Ncaafb roster for a given game



72
73
74
75
76
77
# File 'lib/sports_data_api/ncaafb.rb', line 72

def game_roster(year, season, week, home, away)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/#{week}/#{away}/#{home}/roster.json")

  Game.new(year, season, week, response)
end

.game_statistics(year, season, week, home, away) ⇒ Object

Fetches statistics for a given Ncaafb game



64
65
66
67
68
69
# File 'lib/sports_data_api/ncaafb.rb', line 64

def game_statistics(year, season, week, home, away)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/#{week}/#{away}/#{home}/statistics.json")

  Game.new(year, season, week, response)
end

.play_by_play(year, season, week, home, away) ⇒ Object



102
103
104
105
106
107
# File 'lib/sports_data_api/ncaafb.rb', line 102

def play_by_play(year, season, week, home, away)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/#{week}/#{away}/#{home}/pbp.json")

  PlayByPlay.new(year, season, week, response)
end

.rankings(year, poll, week) ⇒ Object

Fetches Ncaafb season ranking for a given year , poll and week

Raises:



47
48
49
50
51
52
53
# File 'lib/sports_data_api/ncaafb.rb', line 47

def rankings(year, poll, week)
  raise Exception.new("#{poll} is not a valid poll")  unless Polls.valid_name?(poll)
  raise Exception.new("#{week} nr is not a valid week nr") unless Polls.valid_week?(week)

  response = response_json("/polls/#{poll}/#{year}/#{week}/rankings.json")
  Polls.new(response)
end

.schedule(year, season) ⇒ Object

Fetches Ncaafb season schedule for a given year and season



39
40
41
42
43
44
# File 'lib/sports_data_api/ncaafb.rb', line 39

def schedule(year, season)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/schedule.json")

  Season.new(response)
end

.team_roster(team) ⇒ Object

Fetch Ncaafb team roster



88
89
90
91
92
# File 'lib/sports_data_api/ncaafb.rb', line 88

def team_roster(team)
  response = response_json("/teams/#{team}/roster.json")

  TeamRoster.new(response)
end

.teams(division) ⇒ Object

Fetches all Ncaafb teams

Raises:



80
81
82
83
84
85
# File 'lib/sports_data_api/ncaafb.rb', line 80

def teams(division)
  raise Exception.new("#{division} is not a valid division") unless Division.valid?(division)
  response = response_json("/teams/#{division}/hierarchy.json")

  Teams.new(response)
end

.weekly(year, season, week) ⇒ Object

Fetches Ncaafb weekly schedule for a given year, season and week



95
96
97
98
99
100
# File 'lib/sports_data_api/ncaafb.rb', line 95

def weekly(year, season, week)
  season = validate_season(season)
  response = response_json("/#{year}/#{season}/#{week}/schedule.json")

  Games.new(year, season, week, response)
end