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



53
54
55
# File 'lib/sports_data_api/ncaamb.rb', line 53

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



41
42
43
# File 'lib/sports_data_api/ncaamb.rb', line 41

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:



26
27
28
29
30
31
# File 'lib/sports_data_api/ncaamb.rb', line 26

def schedule(year, season)
  season = season.to_s.upcase.to_sym
  raise Error.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



35
36
37
# File 'lib/sports_data_api/ncaamb.rb', line 35

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

.teamsObject

## # Fetches all NCAAMB teams



47
48
49
# File 'lib/sports_data_api/ncaamb.rb', line 47

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:



58
59
60
61
62
63
# File 'lib/sports_data_api/ncaamb.rb', line 58

def tournament_list(year, season)
  season = season.to_s.upcase.to_sym
  raise Error.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:



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

def tournament_schedule(year, season, tournament_id)
  raise Error.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