Sha256: ceca160112b5bfd1e87eda05415a9b37d59b015166e45a28e49803b80e1cc9c0
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
module SportsDataApi module Nhl extend SportsDataApi::Request class Exception < ::Exception end API_VERSION = 5 BASE_URL = 'https://api.sportradar.us/nhl/%{access_level}/v%{version}/en' DIR = File.join(File.dirname(__FILE__), 'nhl') SPORT = :nhl autoload :Team, File.join(DIR, 'team') autoload :Teams, File.join(DIR, 'teams') autoload :Player, File.join(DIR, 'player') autoload :Game, File.join(DIR, 'game') autoload :Games, File.join(DIR, 'games') autoload :Season, File.join(DIR, 'season') autoload :Venue, File.join(DIR, 'venue') autoload :Broadcast, File.join(DIR, 'broadcast') class << self ## # Fetches NHL season schedule for a given year and season 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_json("/games/#{year}/#{season}/schedule.json")) end ## # Fetches NHL team roster def team_roster(team_id) Team.new(response_json("/teams/#{team_id}/profile.json")) end ## # Fetches NHL game summary for a given game def game_summary(game_id) Game.new(json: response_json("/games/#{game_id}/summary.json")) end ## # Fetches all NHL teams def teams Teams.new(response_json('/league/hierarchy.json')) end ## # Fetches NHL daily schedule for a given date def daily(year, month, day) Games.new(response_json("/games/#{year}/#{month}/#{day}/schedule.json")) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sports_data_api-0.13.0 | lib/sports_data_api/nhl.rb |