Class: NBA::BoxScoreSummary

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/nba/box_score_summary.rb

Overview

Represents game summary information

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arenaString

Returns the arena name

Examples:

summary.arena #=> "Chase Center"

Returns:

  • (String)

    the arena



103
# File 'lib/nba/box_score_summary.rb', line 103

attribute :arena, Shale::Type::String

#attendanceInteger

Returns the attendance

Examples:

summary.attendance #=> 18064

Returns:

  • (Integer)

    the attendance



87
# File 'lib/nba/box_score_summary.rb', line 87

attribute :attendance, Shale::Type::Integer

#game_dateString

Returns the game date

Examples:

summary.game_date #=> "2024-10-22"

Returns:

  • (String)

    the game date



23
# File 'lib/nba/box_score_summary.rb', line 23

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

summary.game_id #=> "0022400001"

Returns:

  • (String)

    the game ID



15
# File 'lib/nba/box_score_summary.rb', line 15

attribute :game_id, Shale::Type::String

#game_status_idInteger

Returns the game status ID

Examples:

summary.game_status_id #=> 3

Returns:

  • (Integer)

    the status ID



31
# File 'lib/nba/box_score_summary.rb', line 31

attribute :game_status_id, Shale::Type::Integer

#game_status_textString

Returns the game status text

Examples:

summary.game_status_text #=> "Final"

Returns:

  • (String)

    the status text



39
# File 'lib/nba/box_score_summary.rb', line 39

attribute :game_status_text, Shale::Type::String

#game_timeString

Returns the game duration

Examples:

summary.game_time #=> "2:18"

Returns:

  • (String)

    the game time



95
# File 'lib/nba/box_score_summary.rb', line 95

attribute :game_time, Shale::Type::String

#home_ptsInteger

Returns home team total points

Examples:

summary.home_pts #=> 118

Returns:

  • (Integer)

    total points



175
# File 'lib/nba/box_score_summary.rb', line 175

attribute :home_pts, Shale::Type::Integer

#home_pts_otInteger

Returns home team OT points

Examples:

summary.home_pts_ot #=> 0

Returns:

  • (Integer)

    OT points



167
# File 'lib/nba/box_score_summary.rb', line 167

attribute :home_pts_ot, Shale::Type::Integer

#home_pts_q1Integer

Returns home team Q1 points

Examples:

summary.home_pts_q1 #=> 28

Returns:

  • (Integer)

    Q1 points



135
# File 'lib/nba/box_score_summary.rb', line 135

attribute :home_pts_q1, Shale::Type::Integer

#home_pts_q2Integer

Returns home team Q2 points

Examples:

summary.home_pts_q2 #=> 32

Returns:

  • (Integer)

    Q2 points



143
# File 'lib/nba/box_score_summary.rb', line 143

attribute :home_pts_q2, Shale::Type::Integer

#home_pts_q3Integer

Returns home team Q3 points

Examples:

summary.home_pts_q3 #=> 25

Returns:

  • (Integer)

    Q3 points



151
# File 'lib/nba/box_score_summary.rb', line 151

attribute :home_pts_q3, Shale::Type::Integer

#home_pts_q4Integer

Returns home team Q4 points

Examples:

summary.home_pts_q4 #=> 33

Returns:

  • (Integer)

    Q4 points



159
# File 'lib/nba/box_score_summary.rb', line 159

attribute :home_pts_q4, Shale::Type::Integer

#home_team_idInteger

Returns the home team ID

Examples:

summary.home_team_id #=> 1610612744

Returns:

  • (Integer)

    the home team ID



47
# File 'lib/nba/box_score_summary.rb', line 47

attribute :home_team_id, Shale::Type::Integer

#lead_changesInteger

Returns the number of lead changes

Examples:

summary.lead_changes #=> 12

Returns:

  • (Integer)

    lead changes



111
# File 'lib/nba/box_score_summary.rb', line 111

attribute :lead_changes, Shale::Type::Integer

#live_pc_timeString

Returns the time on the clock if live

Examples:

summary.live_pc_time #=> "0:00"

Returns:

  • (String)

    the live clock time



79
# File 'lib/nba/box_score_summary.rb', line 79

attribute :live_pc_time, Shale::Type::String

#live_periodInteger

Returns the current period if live

Examples:

summary.live_period #=> 4

Returns:

  • (Integer)

    the live period



71
# File 'lib/nba/box_score_summary.rb', line 71

attribute :live_period, Shale::Type::Integer

#officialsArray<String>

Returns the game officials

Examples:

summary.officials #=> ["Scott Foster", "Tony Brothers", "Marc Davis"]

Returns:

  • (Array<String>)

    the officials



127
# File 'lib/nba/box_score_summary.rb', line 127

attribute :officials, Shale::Type::String, collection: true

#seasonString

Returns the season

Examples:

summary.season #=> "2024-25"

Returns:

  • (String)

    the season



63
# File 'lib/nba/box_score_summary.rb', line 63

attribute :season, Shale::Type::String

#times_tiedInteger

Returns the number of times tied

Examples:

summary.times_tied #=> 8

Returns:

  • (Integer)

    times tied



119
# File 'lib/nba/box_score_summary.rb', line 119

attribute :times_tied, Shale::Type::Integer

#visitor_ptsInteger

Returns visitor team total points

Examples:

summary.visitor_pts #=> 109

Returns:

  • (Integer)

    total points



223
# File 'lib/nba/box_score_summary.rb', line 223

attribute :visitor_pts, Shale::Type::Integer

#visitor_pts_otInteger

Returns visitor team OT points

Examples:

summary.visitor_pts_ot #=> 0

Returns:

  • (Integer)

    OT points



215
# File 'lib/nba/box_score_summary.rb', line 215

attribute :visitor_pts_ot, Shale::Type::Integer

#visitor_pts_q1Integer

Returns visitor team Q1 points

Examples:

summary.visitor_pts_q1 #=> 25

Returns:

  • (Integer)

    Q1 points



183
# File 'lib/nba/box_score_summary.rb', line 183

attribute :visitor_pts_q1, Shale::Type::Integer

#visitor_pts_q2Integer

Returns visitor team Q2 points

Examples:

summary.visitor_pts_q2 #=> 28

Returns:

  • (Integer)

    Q2 points



191
# File 'lib/nba/box_score_summary.rb', line 191

attribute :visitor_pts_q2, Shale::Type::Integer

#visitor_pts_q3Integer

Returns visitor team Q3 points

Examples:

summary.visitor_pts_q3 #=> 30

Returns:

  • (Integer)

    Q3 points



199
# File 'lib/nba/box_score_summary.rb', line 199

attribute :visitor_pts_q3, Shale::Type::Integer

#visitor_pts_q4Integer

Returns visitor team Q4 points

Examples:

summary.visitor_pts_q4 #=> 26

Returns:

  • (Integer)

    Q4 points



207
# File 'lib/nba/box_score_summary.rb', line 207

attribute :visitor_pts_q4, Shale::Type::Integer

#visitor_team_idInteger

Returns the visitor team ID

Examples:

summary.visitor_team_id #=> 1610612747

Returns:

  • (Integer)

    the visitor team ID



55
# File 'lib/nba/box_score_summary.rb', line 55

attribute :visitor_team_id, Shale::Type::Integer

Instance Method Details

#final?Boolean

Returns whether the game is final

Examples:

summary.final? #=> true

Returns:

  • (Boolean)

    true if final



261
262
263
# File 'lib/nba/box_score_summary.rb', line 261

def final?
  game_status_id.eql?(3)
end

#gameGame?

Returns the game object

Examples:

summary.game #=> #<NBA::Game>

Returns:

  • (Game, nil)

    the game



251
252
253
# File 'lib/nba/box_score_summary.rb', line 251

def game
  Games.find(game_id)
end

#home_teamTeam?

Returns the home team object

Examples:

summary.home_team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the home team



231
232
233
# File 'lib/nba/box_score_summary.rb', line 231

def home_team
  Teams.find(home_team_id)
end

#in_progress?Boolean

Returns whether the game is in progress

Examples:

summary.in_progress? #=> false

Returns:

  • (Boolean)

    true if in progress



271
272
273
# File 'lib/nba/box_score_summary.rb', line 271

def in_progress?
  game_status_id.eql?(2)
end

#scheduled?Boolean

Returns whether the game has not started

Examples:

summary.scheduled? #=> false

Returns:

  • (Boolean)

    true if scheduled



281
282
283
# File 'lib/nba/box_score_summary.rb', line 281

def scheduled?
  game_status_id.eql?(1)
end

#visitor_teamTeam?

Returns the visitor team object

Examples:

summary.visitor_team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the visitor team



241
242
243
# File 'lib/nba/box_score_summary.rb', line 241

def visitor_team
  Teams.find(visitor_team_id)
end