module SportsDataApi::Ncaafb

Constants

API_VERSION
BASE_URL
DIR
SPORT

Public Class Methods

boxscore(year, season, week, home, away) click to toggle source

Fetches Ncaafb boxscore for a given game

# 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) click to toggle source

Fetches Ncaafb roster for a given game

# 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) click to toggle source

Fetches statistics for a given Ncaafb game

# 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) click to toggle source
# 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) click to toggle source

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

# 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) click to toggle source

Fetches Ncaafb season schedule for a given year and season

# 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) click to toggle source

Fetch Ncaafb team roster

# 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) click to toggle source

Fetches all Ncaafb teams

# 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) click to toggle source

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

# 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

Private Class Methods

validate_season(param) click to toggle source
# File lib/sports_data_api/ncaafb.rb, line 108
def validate_season(param)
  param.to_s.upcase.to_sym.tap do |season|
    unless Season.valid?(season)
      raise Exception.new("#{season} is not a valid season") unless Season.valid?(season)
    end
  end
end