Class: NbaRb::Game::Scoreboard
- Defined in:
- lib/nba_rb/game/scoreboard.rb
Class Attribute Summary collapse
-
.endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#day_offset ⇒ Object
Returns the value of attribute day_offset.
-
#game_date ⇒ Object
Returns the value of attribute game_date.
-
#league_id ⇒ Object
Returns the value of attribute league_id.
Instance Method Summary collapse
- #arena_and_tv_info ⇒ Object
- #eastern_conference_standings_today ⇒ Object
- #endpoint ⇒ Object
-
#initialize(*args) ⇒ Scoreboard
constructor
A new instance of Scoreboard.
- #last_meeting ⇒ Object
- #matchup_teams_info ⇒ Object
- #series_standings ⇒ Object
- #western_conference_standings_today ⇒ Object
Methods included from StatsRequest
Methods included from StatsHash
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
.endpoint ⇒ Object (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
#data ⇒ Object
Returns the value of attribute data.
14 15 16 |
# File 'lib/nba_rb/game/scoreboard.rb', line 14 def data @data end |
#day_offset ⇒ Object
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_date ⇒ Object
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_id ⇒ Object
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_info ⇒ Object
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_today ⇒ Object
54 55 56 |
# File 'lib/nba_rb/game/scoreboard.rb', line 54 def eastern_conference_standings_today create_stats_hash(@data[4]) end |
#endpoint ⇒ Object
10 11 12 |
# File 'lib/nba_rb/game/scoreboard.rb', line 10 def endpoint self.class.endpoint end |
#last_meeting ⇒ Object
50 51 52 |
# File 'lib/nba_rb/game/scoreboard.rb', line 50 def last_meeting create_stats_hash(@data[3]) end |
#matchup_teams_info ⇒ Object
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_standings ⇒ Object
46 47 48 |
# File 'lib/nba_rb/game/scoreboard.rb', line 46 def series_standings create_stats_hash(@data[2]) end |
#western_conference_standings_today ⇒ Object
58 59 60 |
# File 'lib/nba_rb/game/scoreboard.rb', line 58 def western_conference_standings_today create_stats_hash(@data[5]) end |