Class: SportsDataApi::Nba::Game
- Inherits:
-
Object
- Object
- SportsDataApi::Nba::Game
- Defined in:
- lib/sports_data_api/nba/game.rb
Instance Attribute Summary collapse
-
#clock ⇒ Object
readonly
Returns the value of attribute clock.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #away_team ⇒ Object
- #away_team_id ⇒ Object
-
#boxscore ⇒ Object
Wrapper for Nba.boxscore TODO.
- #broadcast ⇒ Object
- #home_team ⇒ Object
- #home_team_id ⇒ Object
-
#initialize(json:, year: nil, season: nil) ⇒ Game
constructor
A new instance of Game.
-
#pbp ⇒ Object
Wrapper for Nba.pbp (Nba.play_by_play) TODO.
- #quarter ⇒ Object
- #scheduled ⇒ Object
-
#summary ⇒ Object
Wrapper for Nba.game_summary TODO.
- #venue ⇒ Object
Constructor Details
#initialize(json:, year: nil, season: nil) ⇒ Game
6 7 8 9 10 11 12 13 |
# File 'lib/sports_data_api/nba/game.rb', line 6 def initialize(json:, year: nil, season: nil) @json = json @year = year @season = season @id = json['id'] @status = json['status'] @clock = json['clock'] end |
Instance Attribute Details
#clock ⇒ Object (readonly)
Returns the value of attribute clock.
4 5 6 |
# File 'lib/sports_data_api/nba/game.rb', line 4 def clock @clock end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/nba/game.rb', line 4 def id @id end |
#season ⇒ Object (readonly)
Returns the value of attribute season.
4 5 6 |
# File 'lib/sports_data_api/nba/game.rb', line 4 def season @season end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/sports_data_api/nba/game.rb', line 4 def status @status end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/sports_data_api/nba/game.rb', line 4 def year @year end |
Instance Method Details
#away_team ⇒ Object
31 32 33 |
# File 'lib/sports_data_api/nba/game.rb', line 31 def away_team @away_team ||= Team.new(json['away']) end |
#away_team_id ⇒ Object
23 24 25 |
# File 'lib/sports_data_api/nba/game.rb', line 23 def away_team_id json['away']['id'] end |
#boxscore ⇒ Object
Wrapper for Nba.boxscore TODO
66 67 68 |
# File 'lib/sports_data_api/nba/game.rb', line 66 def boxscore raise NotImplementedError end |
#broadcast ⇒ Object
44 45 46 47 |
# File 'lib/sports_data_api/nba/game.rb', line 44 def broadcast return nil if json['broadcast'].nil? || json['broadcast'].empty? @broadcast ||= Broadcast.new(json['broadcast']) end |
#home_team ⇒ Object
27 28 29 |
# File 'lib/sports_data_api/nba/game.rb', line 27 def home_team @home_team ||= Team.new(json['home']) end |
#home_team_id ⇒ Object
19 20 21 |
# File 'lib/sports_data_api/nba/game.rb', line 19 def home_team_id json['home']['id'] end |
#pbp ⇒ Object
Wrapper for Nba.pbp (Nba.play_by_play) TODO
59 60 61 |
# File 'lib/sports_data_api/nba/game.rb', line 59 def pbp raise NotImplementedError end |
#quarter ⇒ Object
35 36 37 38 |
# File 'lib/sports_data_api/nba/game.rb', line 35 def quarter return unless json['quarter'] json['quarter'].to_i end |
#scheduled ⇒ Object
15 16 17 |
# File 'lib/sports_data_api/nba/game.rb', line 15 def scheduled @scheduled ||= Time.iso8601 json['scheduled'] end |
#summary ⇒ Object
Wrapper for Nba.game_summary TODO
52 53 54 |
# File 'lib/sports_data_api/nba/game.rb', line 52 def summary Nba.game_summary(id) end |