Class: NBA::TeamGameLogStat

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

Overview

Represents a single team game log entry from the batch endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns the assists

Examples:

log.ast #=> 28

Returns:

  • (Integer)

    assists



185
# File 'lib/nba/team_game_log_stat.rb', line 185

attribute :ast, Shale::Type::Integer

#blkInteger

Returns the blocks

Examples:

log.blk #=> 6

Returns:

  • (Integer)

    blocks



201
# File 'lib/nba/team_game_log_stat.rb', line 201

attribute :blk, Shale::Type::Integer

#drebInteger

Returns the defensive rebounds

Examples:

log.dreb #=> 35

Returns:

  • (Integer)

    defensive rebounds



169
# File 'lib/nba/team_game_log_stat.rb', line 169

attribute :dreb, Shale::Type::Integer

#fg3_pctFloat

Returns the three-point percentage

Examples:

log.fg3_pct #=> 0.395

Returns:

  • (Float)

    three-point percentage



129
# File 'lib/nba/team_game_log_stat.rb', line 129

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns the three-pointers attempted

Examples:

log.fg3a #=> 38

Returns:

  • (Integer)

    three-pointers attempted



121
# File 'lib/nba/team_game_log_stat.rb', line 121

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns the three-pointers made

Examples:

log.fg3m #=> 15

Returns:

  • (Integer)

    three-pointers made



113
# File 'lib/nba/team_game_log_stat.rb', line 113

attribute :fg3m, Shale::Type::Integer

#fg_pctFloat

Returns the field goal percentage

Examples:

log.fg_pct #=> 0.477

Returns:

  • (Float)

    field goal percentage



105
# File 'lib/nba/team_game_log_stat.rb', line 105

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns the field goals attempted

Examples:

log.fga #=> 88

Returns:

  • (Integer)

    field goals attempted



97
# File 'lib/nba/team_game_log_stat.rb', line 97

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns the field goals made

Examples:

log.fgm #=> 42

Returns:

  • (Integer)

    field goals made



89
# File 'lib/nba/team_game_log_stat.rb', line 89

attribute :fgm, Shale::Type::Integer

#ft_pctFloat

Returns the free throw percentage

Examples:

log.ft_pct #=> 0.864

Returns:

  • (Float)

    free throw percentage



153
# File 'lib/nba/team_game_log_stat.rb', line 153

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns the free throws attempted

Examples:

log.fta #=> 22

Returns:

  • (Integer)

    free throws attempted



145
# File 'lib/nba/team_game_log_stat.rb', line 145

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns the free throws made

Examples:

log.ftm #=> 19

Returns:

  • (Integer)

    free throws made



137
# File 'lib/nba/team_game_log_stat.rb', line 137

attribute :ftm, Shale::Type::Integer

#game_dateString

Returns the game date

Examples:

log.game_date #=> "2024-10-22T00:00:00"

Returns:

  • (String)

    the game date



57
# File 'lib/nba/team_game_log_stat.rb', line 57

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

log.game_id #=> "0022400001"

Returns:

  • (String)

    the game ID



49
# File 'lib/nba/team_game_log_stat.rb', line 49

attribute :game_id, Shale::Type::String

#matchupString

Returns the matchup description

Examples:

log.matchup #=> "GSW vs. LAL"

Returns:

  • (String)

    the matchup



65
# File 'lib/nba/team_game_log_stat.rb', line 65

attribute :matchup, Shale::Type::String

#minInteger

Returns the minutes played

Examples:

log.min #=> 240

Returns:

  • (Integer)

    the minutes played



81
# File 'lib/nba/team_game_log_stat.rb', line 81

attribute :min, Shale::Type::Integer

#orebInteger

Returns the offensive rebounds

Examples:

log.oreb #=> 10

Returns:

  • (Integer)

    offensive rebounds



161
# File 'lib/nba/team_game_log_stat.rb', line 161

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns the personal fouls

Examples:

log.pf #=> 20

Returns:

  • (Integer)

    personal fouls



217
# File 'lib/nba/team_game_log_stat.rb', line 217

attribute :pf, Shale::Type::Integer

#plus_minusInteger

Returns the plus/minus

Examples:

log.plus_minus #=> 9

Returns:

  • (Integer)

    plus/minus



233
# File 'lib/nba/team_game_log_stat.rb', line 233

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns the points scored

Examples:

log.pts #=> 118

Returns:

  • (Integer)

    points



225
# File 'lib/nba/team_game_log_stat.rb', line 225

attribute :pts, Shale::Type::Integer

#rebInteger

Returns the total rebounds

Examples:

log.reb #=> 45

Returns:

  • (Integer)

    total rebounds



177
# File 'lib/nba/team_game_log_stat.rb', line 177

attribute :reb, Shale::Type::Integer

#season_yearString

Returns the season year

Examples:

log.season_year #=> "2024-25"

Returns:

  • (String)

    the season year



17
# File 'lib/nba/team_game_log_stat.rb', line 17

attribute :season_year, Shale::Type::String

#stlInteger

Returns the steals

Examples:

log.stl #=> 9

Returns:

  • (Integer)

    steals



193
# File 'lib/nba/team_game_log_stat.rb', line 193

attribute :stl, Shale::Type::Integer

#team_abbreviationString

Returns the team abbreviation

Examples:

log.team_abbreviation #=> "GSW"

Returns:

  • (String)

    the team abbreviation



33
# File 'lib/nba/team_game_log_stat.rb', line 33

attribute :team_abbreviation, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

log.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



25
# File 'lib/nba/team_game_log_stat.rb', line 25

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

log.team_name #=> "Warriors"

Returns:

  • (String)

    the team name



41
# File 'lib/nba/team_game_log_stat.rb', line 41

attribute :team_name, Shale::Type::String

#tovInteger

Returns the turnovers

Examples:

log.tov #=> 14

Returns:

  • (Integer)

    turnovers



209
# File 'lib/nba/team_game_log_stat.rb', line 209

attribute :tov, Shale::Type::Integer

#wlString

Returns the win/loss indicator

Examples:

log.wl #=> "W"

Returns:

  • (String)

    W for win, L for loss



73
# File 'lib/nba/team_game_log_stat.rb', line 73

attribute :wl, Shale::Type::String

Instance Method Details

#gameGame?

Returns the game object for this log entry

Examples:

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

Returns:

  • (Game, nil)

    the game object



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

def game
  Games.find(game_id)
end

#loss?Boolean

Returns whether the game was a loss

Examples:

log.loss? #=> false

Returns:

  • (Boolean)

    true if the game was a loss



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

def loss?
  wl.eql?("L")
end

#teamTeam?

Returns the team object for this log entry

Examples:

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

Returns:

  • (Team, nil)

    the team object



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

def team
  Teams.find(team_id)
end

#win?Boolean

Returns whether the game was a win

Examples:

log.win? #=> true

Returns:

  • (Boolean)

    true if the game was a win



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

def win?
  wl.eql?("W")
end