Class: NbaRb::Game::Scoreboard

Inherits:
BaseClass show all
Defined in:
lib/nba_rb/game/scoreboard.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StatsRequest

#stats_request

Methods included from StatsHash

#create_stats_hash

Constructor Details

#initialize(*args) ⇒ Scoreboard

Returns a new instance of Scoreboard.



19
20
21
22
23
24
25
26
27
28
29
30
31
# 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

Class Attribute Details

.endpointObject (readonly)

Returns the value of attribute endpoint.



7
8
9
# File 'lib/nba_rb/game/scoreboard.rb', line 7

def endpoint
  @endpoint
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/nba_rb/game/scoreboard.rb', line 14

def data
  @data
end

#day_offsetObject

Returns the value of attribute day_offset.



14
15
16
# File 'lib/nba_rb/game/scoreboard.rb', line 14

def day_offset
  @day_offset
end

#game_dateObject

Returns the value of attribute game_date.



14
15
16
# File 'lib/nba_rb/game/scoreboard.rb', line 14

def game_date
  @game_date
end

#league_idObject

Returns the value of attribute league_id.



14
15
16
# File 'lib/nba_rb/game/scoreboard.rb', line 14

def league_id
  @league_id
end

Instance Method Details

#arena_and_tv_infoObject



33
34
35
# File 'lib/nba_rb/game/scoreboard.rb', line 33

def arena_and_tv_info
  create_stats_hash(@data[0])
end

#eastern_conference_standings_todayObject



54
55
56
# File 'lib/nba_rb/game/scoreboard.rb', line 54

def eastern_conference_standings_today
  create_stats_hash(@data[4])
end

#endpointObject



10
11
12
# File 'lib/nba_rb/game/scoreboard.rb', line 10

def endpoint
  self.class.endpoint
end

#last_meetingObject



50
51
52
# File 'lib/nba_rb/game/scoreboard.rb', line 50

def last_meeting
  create_stats_hash(@data[3])
end

#matchup_teams_infoObject



37
38
39
40
41
42
43
44
# 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_standingsObject



46
47
48
# File 'lib/nba_rb/game/scoreboard.rb', line 46

def series_standings
  create_stats_hash(@data[2])
end

#western_conference_standings_todayObject



58
59
60
# File 'lib/nba_rb/game/scoreboard.rb', line 58

def western_conference_standings_today
  create_stats_hash(@data[5])
end