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

Returns:

  • (Integer)

    assists



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

attribute :ast, Shale::Type::Integer

#blkInteger

Returns blocks

Examples:

game.blk #=> 5

Returns:

  • (Integer)

    blocks



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

attribute :blk, Shale::Type::Integer

#drebInteger

Returns defensive rebounds

Examples:

game.dreb #=> 32

Returns:

  • (Integer)

    defensive rebounds



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

Returns:

  • (Float)

    three-point percentage



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

attribute :fg3_pct, Shale::Type::Float

#fg3aInteger

Returns three-pointers attempted

Examples:

game.fg3a #=> 35

Returns:

  • (Integer)

    three-pointers attempted



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

attribute :fg3a, Shale::Type::Integer

#fg3mInteger

Returns three-pointers made

Examples:

game.fg3m #=> 14

Returns:

  • (Integer)

    three-pointers made



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

Returns:

  • (Float)

    field goal percentage



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

attribute :fg_pct, Shale::Type::Float

#fgaInteger

Returns field goals attempted

Examples:

game.fga #=> 85

Returns:

  • (Integer)

    field goals attempted



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

attribute :fga, Shale::Type::Integer

#fgmInteger

Returns field goals made

Examples:

game.fgm #=> 42

Returns:

  • (Integer)

    field goals made



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

Returns:

  • (Float)

    free throw percentage



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

attribute :ft_pct, Shale::Type::Float

#ftaInteger

Returns free throws attempted

Examples:

game.fta #=> 15

Returns:

  • (Integer)

    free throws attempted



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

attribute :fta, Shale::Type::Integer

#ftmInteger

Returns free throws made

Examples:

game.ftm #=> 12

Returns:

  • (Integer)

    free throws made



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"

Returns:

  • (String)

    the game date



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"

Returns:

  • (String)

    the game ID



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"

Returns:

  • (String)

    the matchup



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

attribute :matchup, Shale::Type::String

#minInteger

Returns minutes played

Examples:

game.min #=> 240

Returns:

  • (Integer)

    minutes



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

attribute :min, Shale::Type::Integer

#orebInteger

Returns offensive rebounds

Examples:

game.oreb #=> 10

Returns:

  • (Integer)

    offensive rebounds



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

attribute :oreb, Shale::Type::Integer

#pfInteger

Returns personal fouls

Examples:

game.pf #=> 18

Returns:

  • (Integer)

    personal fouls



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

attribute :pf, Shale::Type::Integer

#plus_minusInteger

Returns plus/minus

Examples:

game.plus_minus #=> 10

Returns:

  • (Integer)

    plus/minus



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

attribute :plus_minus, Shale::Type::Integer

#ptsInteger

Returns points scored

Examples:

game.pts #=> 110

Returns:

  • (Integer)

    points



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

attribute :pts, Shale::Type::Integer

#rebInteger

Returns total rebounds

Examples:

game.reb #=> 42

Returns:

  • (Integer)

    total rebounds



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"

Returns:

  • (String)

    the season ID



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

attribute :season_id, Shale::Type::String

#stlInteger

Returns steals

Examples:

game.stl #=> 8

Returns:

  • (Integer)

    steals



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"

Returns:

  • (String)

    the team abbreviation



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

Returns:

  • (Integer)

    the team ID



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"

Returns:

  • (String)

    the team name



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

attribute :team_name, Shale::Type::String

#tovInteger

Returns turnovers

Examples:

game.tov #=> 12

Returns:

  • (Integer)

    turnovers



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

attribute :tov, Shale::Type::Integer

#wlString

Returns win/loss result

Examples:

game.wl #=> "W"

Returns:

  • (String)

    W or L



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

Returns:

  • (Boolean)

    true if loss



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>

Returns:

  • (Team, nil)

    the team object



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

Returns:

  • (Boolean)

    true if win



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

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