class NbaRb::Game::Scoreboard

Attributes

endpoint[R]
data[RW]
day_offset[RW]
game_date[RW]
league_id[RW]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Initializable::new
# File lib/nba_rb/game/scoreboard.rb, line 19
def initialize(*args)
  super(*args)

  @league_id ||= NbaRb::League.default
  @game_date ||= Date.today.to_s.tr('-', ' ')
  @day_offset ||= 0

  res = stats_request(endpoint, 'LeagueID' => league_id,
                                'gameDate' => game_date,
                                'DayOffset' => day_offset)

  @data = res['resultSets']
end

Public Instance Methods

arena_and_tv_info() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 33
def arena_and_tv_info
  create_stats_hash(@data[0])
end
eastern_conference_standings_today() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 54
def eastern_conference_standings_today
  create_stats_hash(@data[4])
end
endpoint() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 10
def endpoint
  self.class.endpoint
end
last_meeting() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 50
def last_meeting
  create_stats_hash(@data[3])
end
matchup_teams_info() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 37
def matchup_teams_info
  # Each team has its own array of info. The second element in the array
  # is the # of the game they play in. Example:
  # [date_of_game, 1, '...', 'Charlotte']
  # [date_of_game, 1, '...', 'Washington']
  # The first game is Charlotte @ Washington
  create_stats_hash(@data[1])
end
series_standings() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 46
def series_standings
  create_stats_hash(@data[2])
end
western_conference_standings_today() click to toggle source
# File lib/nba_rb/game/scoreboard.rb, line 58
def western_conference_standings_today
  create_stats_hash(@data[5])
end