class SportsDataApi::Nhl::Game

Attributes

away_team_id[R]
clock[R]
home_team_id[R]
id[R]
json[R]
season[R]
status[R]
year[R]

Public Class Methods

new(json:, year: nil, season: nil) click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 7
def initialize(json:, year: nil, season: nil)
  @json = json
  @year = year
  @season = season
  @id = json['id']
  @home_team_id = json['home']['id']
  @away_team_id = json['away']['id']
  @status = json['status']
  @clock = json['clock']
end

Public Instance Methods

away_team() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 31
def away_team
  @away_team ||= Team.new(json['away'])
end
boxscore() click to toggle source

Wrapper for Nhl.boxscore TODO

# File lib/sports_data_api/nhl/game.rb, line 61
def boxscore
  raise NotImplementedError
end
broadcast() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 35
def broadcast
  return if json['broadcast'].nil? || json['broadcast'].empty?
  @broadcast ||= Broadcast.new(json['broadcast'])
end
home_team() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 27
def home_team
  @home_team ||= Team.new(json['home'])
end
pbp() click to toggle source

Wrapper for Nhl.pbp (Nhl.play_by_play) TODO

# File lib/sports_data_api/nhl/game.rb, line 54
def pbp
  raise NotImplementedError
end
period() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 18
def period
  return unless json['period']
  json['period'].to_i
end
scheduled() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 23
def scheduled
  @scheduled = Time.parse(json['scheduled'])
end
summary() click to toggle source

Wrapper for Nhl.game_summary

# File lib/sports_data_api/nhl/game.rb, line 47
def summary
  Nhl.game_summary(id)
end
venue() click to toggle source
# File lib/sports_data_api/nhl/game.rb, line 40
def venue
  return if json['venue'].nil? || json['venue'].empty?
  @venue ||= Venue.new(json['venue'])
end