Class: NBA::BoxScoreFourFactorsPlayerStat

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

Overview

Represents a player's four factors box score statistics for a game

API:

  • public

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#comment ⇒ String

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

Examples:

stat.comment #=> "DNP - Rest"

Returns:

  • the comment

API:

  • public



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

attribute :comment, Shale::Type::String

#efg_pct ⇒ Float

Returns effective field goal percentage

Examples:

stat.efg_pct #=> 0.625

Returns:

  • the effective field goal percentage

API:

  • public



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

attribute :efg_pct, Shale::Type::Float

#fta_rate ⇒ Float

Returns free throw attempt rate

Examples:

stat.fta_rate #=> 0.45

Returns:

  • the free throw attempt rate

API:

  • public



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

attribute :fta_rate, Shale::Type::Float

#game_id ⇒ String

Returns the game ID

Examples:

stat.game_id #=> "0022400350"

Returns:

  • the game ID

API:

  • public



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

attribute :game_id, Shale::Type::String

#min ⇒ String

Returns minutes played

Examples:

stat.min #=> "32:45"

Returns:

  • the minutes played

API:

  • public



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

attribute :min, Shale::Type::String

#opp_efg_pct ⇒ Float

Returns opponent effective field goal percentage

Examples:

stat.opp_efg_pct #=> 0.485

Returns:

  • the opponent effective field goal percentage

API:

  • public



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

attribute :opp_efg_pct, Shale::Type::Float

#opp_fta_rate ⇒ Float

Returns opponent free throw attempt rate

Examples:

stat.opp_fta_rate #=> 0.28

Returns:

  • the opponent free throw attempt rate

API:

  • public



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

attribute :opp_fta_rate, Shale::Type::Float

#opp_oreb_pct ⇒ Float

Returns opponent offensive rebound percentage

Examples:

stat.opp_oreb_pct #=> 22.5

Returns:

  • the opponent offensive rebound percentage

API:

  • public



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

attribute :opp_oreb_pct, Shale::Type::Float

#opp_tov_pct ⇒ Float

Returns opponent turnover percentage

Examples:

stat.opp_tov_pct #=> 15.6

Returns:

  • the opponent turnover percentage

API:

  • public



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

attribute :opp_tov_pct, Shale::Type::Float

#oreb_pct ⇒ Float

Returns offensive rebound percentage

Examples:

stat.oreb_pct #=> 3.2

Returns:

  • the offensive rebound percentage

API:

  • public



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

attribute :oreb_pct, Shale::Type::Float

#player_id ⇒ Integer

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • the player ID

API:

  • public



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

attribute :player_id, Shale::Type::Integer

#player_name ⇒ String

Returns the player name

Examples:

stat.player_name #=> "Stephen Curry"

Returns:

  • the player name

API:

  • public



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

attribute :player_name, Shale::Type::String

#start_position ⇒ String

Returns the starting position

Examples:

stat.start_position #=> "G"

Returns:

  • the starting position

API:

  • public



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

attribute :start_position, Shale::Type::String

#team_abbreviation ⇒ String

Returns the team abbreviation

Examples:

stat.team_abbreviation #=> "GSW"

Returns:

  • the team abbreviation

API:

  • public



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

attribute :team_abbreviation, Shale::Type::String

#team_city ⇒ String

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • the team city

API:

  • public



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

attribute :team_city, Shale::Type::String

#team_id ⇒ Integer

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • the team ID

API:

  • public



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

attribute :team_id, Shale::Type::Integer

#tov_pct ⇒ Float

Returns turnover percentage

Examples:

stat.tov_pct #=> 12.3

Returns:

  • the turnover percentage

API:

  • public



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

attribute :tov_pct, Shale::Type::Float

Instance Method Details

#game ⇒ Game?

Returns the game object for this box score

Examples:

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

Returns:

  • the game object

API:

  • public



181
182
183
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 181

def game
  Games.find(game_id)
end

#player ⇒ Player?

Returns the player object

Examples:

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

Returns:

  • the player object

API:

  • public



151
152
153
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 151

def player
  Players.find(player_id)
end

#starter? ⇒ Boolean

Returns whether the player started the game

Examples:

stat.starter? #=> true

Returns:

  • true if the player started

API:

  • public



171
172
173
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 171

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

#team ⇒ Team?

Returns the team object

Examples:

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

Returns:

  • the team object

API:

  • public



161
162
163
# File 'lib/nba/box_score_four_factors_player_stat.rb', line 161

def team
  Teams.find(team_id)
end