Module: SportsDataApi::Ncaamb

Extended by:
Request
Defined in:
lib/sports_data_api/ncaamb.rb,
lib/sports_data_api/ncaamb/game.rb,
lib/sports_data_api/ncaamb/team.rb,
lib/sports_data_api/ncaamb/games.rb,
lib/sports_data_api/ncaamb/teams.rb,
lib/sports_data_api/ncaamb/venue.rb,
lib/sports_data_api/ncaamb/player.rb,
lib/sports_data_api/ncaamb/season.rb,
lib/sports_data_api/ncaamb/broadcast.rb,
lib/sports_data_api/ncaamb/tournament.rb,
lib/sports_data_api/ncaamb/tournament_game.rb,
lib/sports_data_api/ncaamb/tournament_list.rb,
lib/sports_data_api/ncaamb/tournament_schedule.rb

Defined Under Namespace

Classes: Broadcast, Exception, Game, Games, Player, Season, Team, Teams, Tournament, TournamentGame, TournamentList, TournamentSchedule, Venue

Constant Summary collapse

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

Class Method Summary collapse

Methods included from Request

response_json, response_xml, response_xml_xpath

Class Method Details

.daily(year, month, day) ⇒ Object

## # Fetches NCAAMB daily schedule for a given date



56
57
58
# File 'lib/sports_data_api/ncaamb.rb', line 56

def daily(year, month, day)
  Games.new(response_xml_xpath("/games/#{year}/#{month}/#{day}/schedule.xml", 'league/daily-schedule'))
end

.game_summary(game) ⇒ Object

## # Fetches NCAAMB game summary for a given game



44
45
46
# File 'lib/sports_data_api/ncaamb.rb', line 44

def game_summary(game)
  Game.new(xml: response_xml_xpath("/games/#{game}/summary.xml", '/game'))
end

.schedule(year, season) ⇒ Object

Fetches NCAAAMB season schedule for a given year and season

Raises:



29
30
31
32
33
34
# File 'lib/sports_data_api/ncaamb.rb', line 29

def schedule(year, season)
  season = season.to_s.upcase.to_sym
  raise Exception.new("#{season} is not a valid season") unless Season.valid?(season)

  Season.new(response_xml_xpath("/games/#{year}/#{season}/schedule.xml", '/league/season-schedule'))
end

.team_roster(team) ⇒ Object

## # Fetches NCAAMB team roster



38
39
40
# File 'lib/sports_data_api/ncaamb.rb', line 38

def team_roster(team)
  Team.new(response_xml_xpath("/teams/#{team}/profile.xml", 'team'))
end

.teamsObject

## # Fetches all NCAAMB teams



50
51
52
# File 'lib/sports_data_api/ncaamb.rb', line 50

def teams
  Teams.new(response_xml_xpath('/league/hierarchy.xml', '/league'))
end

.tournament_list(year, season) ⇒ Object

Fetches NCAAAMB tournaments for a given year and season

Raises:



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

def tournament_list(year, season)
  season = season.to_s.upcase.to_sym
  raise Exception.new("#{season} is not a valid season") unless TournamentList.valid?(season)

  TournamentList.new(response_xml_xpath("/tournaments/#{year}/#{season}/schedule.xml", '/league/season-schedule'))
end

.tournament_schedule(year, season, tournament_id) ⇒ Object

Raises:



68
69
70
71
72
# File 'lib/sports_data_api/ncaamb.rb', line 68

def tournament_schedule(year, season, tournament_id)
  raise Exception.new("#{season} is not a valid season") unless TournamentSchedule.valid?(season)

  TournamentSchedule.new(year, season, response_xml_xpath("/tournaments/#{tournament_id}/schedule.xml", '/league/tournament-schedule'))
end