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, 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



53
54
55
56
57
58
# File 'lib/sports_data_api/ncaafb.rb', line 53

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



69
70
71
72
73
74
# File 'lib/sports_data_api/ncaafb.rb', line 69

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



61
62
63
64
65
66
# File 'lib/sports_data_api/ncaafb.rb', line 61

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



99
100
101
102
103
104
# File 'lib/sports_data_api/ncaafb.rb', line 99

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:



44
45
46
47
48
49
50
# File 'lib/sports_data_api/ncaafb.rb', line 44

def rankings(year, poll, week)
  raise Error.new("#{poll} is not a valid poll")  unless Polls.valid_name?(poll)
  raise Error.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



36
37
38
39
40
41
# File 'lib/sports_data_api/ncaafb.rb', line 36

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



85
86
87
88
89
# File 'lib/sports_data_api/ncaafb.rb', line 85

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

  TeamRoster.new(response)
end

.teams(division) ⇒ Object

Fetches all Ncaafb teams

Raises:

  • (Exception)


77
78
79
80
81
82
# File 'lib/sports_data_api/ncaafb.rb', line 77

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



92
93
94
95
96
97
# File 'lib/sports_data_api/ncaafb.rb', line 92

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

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