Class: NBA::BoxScoreScoringPlayerStat

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

Overview

Represents a player’s scoring box score statistics for a game

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentString

Returns any comment (e.g., “DNP - Rest”)

Examples:

stat.comment #=> "DNP - Rest"

Returns:

  • (String)

    the comment



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

attribute :comment, Shale::Type::String

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400565"

Returns:

  • (String)

    the game ID



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

attribute :game_id, Shale::Type::String

#minString

Returns minutes played

Examples:

stat.min #=> "35:24"

Returns:

  • (String)

    the minutes played



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

attribute :min, Shale::Type::String

#pct_ast_2pmFloat

Returns percentage of 2-point makes that were assisted

Examples:

stat.pct_ast_2pm #=> 0.65

Returns:

  • (Float)

    the percentage



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

attribute :pct_ast_2pm, Shale::Type::Float

#pct_ast_3pmFloat

Returns percentage of 3-point makes that were assisted

Examples:

stat.pct_ast_3pm #=> 0.85

Returns:

  • (Float)

    the percentage



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

attribute :pct_ast_3pm, Shale::Type::Float

#pct_ast_fgmFloat

Returns percentage of field goal makes that were assisted

Examples:

stat.pct_ast_fgm #=> 0.75

Returns:

  • (Float)

    the percentage



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

attribute :pct_ast_fgm, Shale::Type::Float

#pct_fga_2ptFloat

Returns percentage of field goals from 2-point range

Examples:

stat.pct_fga_2pt #=> 0.45

Returns:

  • (Float)

    the percentage



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

attribute :pct_fga_2pt, Shale::Type::Float

#pct_fga_3ptFloat

Returns percentage of field goals from 3-point range

Examples:

stat.pct_fga_3pt #=> 0.55

Returns:

  • (Float)

    the percentage



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

attribute :pct_fga_3pt, Shale::Type::Float

#pct_pts_2ptFloat

Returns percentage of points from 2-point shots

Examples:

stat.pct_pts_2pt #=> 0.40

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_2pt, Shale::Type::Float

#pct_pts_2pt_mrFloat

Returns percentage of points from mid-range 2-point shots

Examples:

stat.pct_pts_2pt_mr #=> 0.15

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_2pt_mr, Shale::Type::Float

#pct_pts_3ptFloat

Returns percentage of points from 3-point shots

Examples:

stat.pct_pts_3pt #=> 0.50

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_3pt, Shale::Type::Float

#pct_pts_fbFloat

Returns percentage of points from fast break

Examples:

stat.pct_pts_fb #=> 0.12

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_fb, Shale::Type::Float

#pct_pts_ftFloat

Returns percentage of points from free throws

Examples:

stat.pct_pts_ft #=> 0.10

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_ft, Shale::Type::Float

#pct_pts_off_tovFloat

Returns percentage of points off turnovers

Examples:

stat.pct_pts_off_tov #=> 0.18

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_off_tov, Shale::Type::Float

#pct_pts_paintFloat

Returns percentage of points in the paint

Examples:

stat.pct_pts_paint #=> 0.35

Returns:

  • (Float)

    the percentage



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

attribute :pct_pts_paint, Shale::Type::Float

#pct_uast_2pmFloat

Returns percentage of 2-point makes that were unassisted

Examples:

stat.pct_uast_2pm #=> 0.35

Returns:

  • (Float)

    the percentage



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

attribute :pct_uast_2pm, Shale::Type::Float

#pct_uast_3pmFloat

Returns percentage of 3-point makes that were unassisted

Examples:

stat.pct_uast_3pm #=> 0.15

Returns:

  • (Float)

    the percentage



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

attribute :pct_uast_3pm, Shale::Type::Float

#pct_uast_fgmFloat

Returns percentage of field goal makes that were unassisted

Examples:

stat.pct_uast_fgm #=> 0.25

Returns:

  • (Float)

    the percentage



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

attribute :pct_uast_fgm, Shale::Type::Float

#player_idInteger

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer)

    the player ID



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

attribute :player_id, Shale::Type::Integer

#player_nameString

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"

Returns:

  • (String)

    the player name



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

attribute :player_name, Shale::Type::String

#start_positionString

Returns the starting position

Examples:

stat.start_position #=> "G"

Returns:

  • (String)

    the starting position



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

attribute :start_position, Shale::Type::String

#team_abbreviationString

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



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

attribute :team_abbreviation, Shale::Type::String

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



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

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

Instance Method Details

#gameGame?

Returns the game object for this box score

Examples:

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

Returns:

  • (Game, nil)

    the game object



237
238
239
# File 'lib/nba/box_score_scoring_player_stat.rb', line 237

def game
  Games.find(game_id)
end

#playerPlayer?

Returns the player object

Examples:

stat.player #=> #<NBA::Player>

Returns:

  • (Player, nil)

    the player object



207
208
209
# File 'lib/nba/box_score_scoring_player_stat.rb', line 207

def player
  Players.find(player_id)
end

#starter?Boolean

Returns whether the player started the game

Examples:

stat.starter? #=> true

Returns:

  • (Boolean)

    true if the player started



227
228
229
# File 'lib/nba/box_score_scoring_player_stat.rb', line 227

def starter?
  !start_position.nil? && !start_position.empty?
end

#teamTeam?

Returns the team object

Examples:

stat.team #=> #<NBA::Team>

Returns:

  • (Team, nil)

    the team object



217
218
219
# File 'lib/nba/box_score_scoring_player_stat.rb', line 217

def team
  Teams.find(team_id)
end