Class: NBA::FoundGame

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

Overview

Represents a found game from the league game finder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#astInteger

Returns assists

Examples:

game.ast #=> 28


188
# File 'lib/nba/found_game.rb', line 188

attribute :ast, Shale::Type::Integer

#blkInteger

Returns blocks

Examples:

game.blk #=> 5


204
# File 'lib/nba/found_game.rb', line 204

attribute :blk, Shale::Type::Integer

#drebInteger

Returns defensive rebounds

Examples:

game.dreb #=> 32


172
# File 'lib/nba/found_game.rb', line 172

attribute :dreb, Shale::Type::Integer

#fg3_pctFloat

Returns three-point percentage

Examples:

game.fg3_pct #=> 0.4


132
# File 'lib/nba/found_game.rb', line 132

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns three-pointers attempted

Examples:

game.fg3a #=> 35


124
# File 'lib/nba/found_game.rb', line 124

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns three-pointers made

Examples:

game.fg3m #=> 14


116
# File 'lib/nba/found_game.rb', line 116

attribute :fg3m, Shale::Type::Integer

#fg_pctFloat

Returns field goal percentage

Examples:

game.fg_pct #=> 0.494


108
# File 'lib/nba/found_game.rb', line 108

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns field goals attempted

Examples:

game.fga #=> 85


100
# File 'lib/nba/found_game.rb', line 100

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns field goals made

Examples:

game.fgm #=> 42


92
# File 'lib/nba/found_game.rb', line 92

attribute :fgm, Shale::Type::Integer

#ft_pctFloat

Returns free throw percentage

Examples:

game.ft_pct #=> 0.8


156
# File 'lib/nba/found_game.rb', line 156

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns free throws attempted

Examples:

game.fta #=> 15


148
# File 'lib/nba/found_game.rb', line 148

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns free throws made

Examples:

game.ftm #=> 12


140
# File 'lib/nba/found_game.rb', line 140

attribute :ftm, Shale::Type::Integer

#game_dateString

Returns the game date

Examples:

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


52
# File 'lib/nba/found_game.rb', line 52

attribute :game_date, Shale::Type::String

#game_idString

Returns the game ID

Examples:

game.game_id #=> "0022400001"


44
# File 'lib/nba/found_game.rb', line 44

attribute :game_id, Shale::Type::String

#matchupString

Returns the matchup string

Examples:

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


60
# File 'lib/nba/found_game.rb', line 60

attribute :matchup, Shale::Type::String

#minInteger

Returns minutes played

Examples:

game.min #=> 240


76
# File 'lib/nba/found_game.rb', line 76

attribute :min, Shale::Type::Integer

#orebInteger

Returns offensive rebounds

Examples:

game.oreb #=> 10


164
# File 'lib/nba/found_game.rb', line 164

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns personal fouls

Examples:

game.pf #=> 18


220
# File 'lib/nba/found_game.rb', line 220

attribute :pf, Shale::Type::Integer

#plus_minusInteger

Returns plus/minus

Examples:

game.plus_minus #=> 10


228
# File 'lib/nba/found_game.rb', line 228

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns points scored

Examples:

game.pts #=> 110


84
# File 'lib/nba/found_game.rb', line 84

attribute :pts, Shale::Type::Integer

#rebInteger

Returns total rebounds

Examples:

game.reb #=> 42


180
# File 'lib/nba/found_game.rb', line 180

attribute :reb, Shale::Type::Integer

#season_idString

Returns the season ID

Examples:

game.season_id #=> "22024"


12
# File 'lib/nba/found_game.rb', line 12

attribute :season_id, Shale::Type::String

#stlInteger

Returns steals

Examples:

game.stl #=> 8


196
# File 'lib/nba/found_game.rb', line 196

attribute :stl, Shale::Type::Integer

#team_abbreviationString

Returns the team abbreviation

Examples:

game.team_abbreviation #=> "GSW"


28
# File 'lib/nba/found_game.rb', line 28

attribute :team_abbreviation, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

game.team_id #=> 1610612744


20
# File 'lib/nba/found_game.rb', line 20

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

game.team_name #=> "Warriors"


36
# File 'lib/nba/found_game.rb', line 36

attribute :team_name, Shale::Type::String

#tovInteger

Returns turnovers

Examples:

game.tov #=> 12


212
# File 'lib/nba/found_game.rb', line 212

attribute :tov, Shale::Type::Integer

#wlString

Returns win/loss result

Examples:

game.wl #=> "W"


68
# File 'lib/nba/found_game.rb', line 68

attribute :wl, Shale::Type::String

Instance Method Details

#loss?Boolean

Returns whether the game was a loss

Examples:

game.loss? #=> true


256
257
258
# File 'lib/nba/found_game.rb', line 256

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

#teamTeam?

Returns the team object

Examples:

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


236
237
238
# File 'lib/nba/found_game.rb', line 236

def team
  Teams.find(team_id)
end

#win?Boolean

Returns whether the game was a win

Examples:

game.win? #=> true


246
247
248
# File 'lib/nba/found_game.rb', line 246

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