Class: NBA::LivePlayerStat

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

Overview

Represents a player's live box score stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assists ⇒ Integer

Returns assists

Examples:

stat.assists #=> 8

Returns:

  • (Integer) —

    assists



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

attribute :assists, Shale::Type::Integer

#blocks ⇒ Integer

Returns blocks

Examples:

stat.blocks #=> 1

Returns:

  • (Integer) —

    blocks



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

attribute :blocks, Shale::Type::Integer

#family_name ⇒ String

Returns the player's family name

Examples:

stat.family_name #=> "Curry"

Returns:

  • (String) —

    the family name



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

attribute :family_name, Shale::Type::String

#field_goals_attempted ⇒ Integer

Returns field goals attempted

Examples:

stat.field_goals_attempted #=> 20

Returns:

  • (Integer) —

    field goals attempted



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

attribute :field_goals_attempted, Shale::Type::Integer

#field_goals_made ⇒ Integer

Returns field goals made

Examples:

stat.field_goals_made #=> 10

Returns:

  • (Integer) —

    field goals made



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

attribute :field_goals_made, Shale::Type::Integer

#field_goals_percentage ⇒ Float

Returns field goal percentage

Examples:

stat.field_goals_percentage #=> 0.5

Returns:

  • (Float) —

    field goal percentage



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

attribute :field_goals_percentage, Shale::Type::Float

#first_name ⇒ String

Returns the player's first name

Examples:

stat.first_name #=> "Stephen"

Returns:

  • (String) —

    the first name



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

attribute :first_name, Shale::Type::String

#fouls_personal ⇒ Integer

Returns personal fouls

Examples:

stat.fouls_personal #=> 2

Returns:

  • (Integer) —

    personal fouls



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

attribute :fouls_personal, Shale::Type::Integer

#free_throws_attempted ⇒ Integer

Returns free throws attempted

Examples:

stat.free_throws_attempted #=> 3

Returns:

  • (Integer) —

    free throws attempted



236
# File 'lib/nba/live_player_stat.rb', line 236

attribute :free_throws_attempted, Shale::Type::Integer

#free_throws_made ⇒ Integer

Returns free throws made

Examples:

stat.free_throws_made #=> 3

Returns:

  • (Integer) —

    free throws made



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

attribute :free_throws_made, Shale::Type::Integer

#free_throws_percentage ⇒ Float

Returns free throw percentage

Examples:

stat.free_throws_percentage #=> 1.0

Returns:

  • (Float) —

    free throw percentage



244
# File 'lib/nba/live_player_stat.rb', line 244

attribute :free_throws_percentage, Shale::Type::Float

#game_id ⇒ String

Returns the game ID

Examples:

stat.game_id #=> "0022400001"

Returns:

  • (String) —

    the game ID



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

attribute :game_id, Shale::Type::String

#jersey_num ⇒ String

Returns the jersey number

Examples:

stat.jersey_num #=> "30"

Returns:

  • (String) —

    the jersey number



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

attribute :jersey_num, Shale::Type::String

#minutes ⇒ String

Returns minutes played

Examples:

stat.minutes #=> "PT34M12S"

Returns:

  • (String) —

    minutes in ISO 8601 duration format



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

attribute :minutes, Shale::Type::String

#name ⇒ String

Returns the player name

Examples:

stat.name #=> "Stephen Curry"

Returns:

  • (String) —

    the player name



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

attribute :name, Shale::Type::String

#player_id ⇒ Integer

Returns the player ID

Examples:

stat.player_id #=> 201939

Returns:

  • (Integer) —

    the player ID



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

attribute :player_id, Shale::Type::Integer

#plus_minus ⇒ Float

Returns plus/minus

Examples:

stat.plus_minus #=> 12.0

Returns:

  • (Float) —

    plus/minus



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

attribute :plus_minus, Shale::Type::Float

#points ⇒ Integer

Returns points scored

Examples:

stat.points #=> 28

Returns:

  • (Integer) —

    points



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

attribute :points, Shale::Type::Integer

#position ⇒ String

Returns the position

Examples:

stat.position #=> "G"

Returns:

  • (String) —

    the position



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

attribute :position, Shale::Type::String

#rebounds_defensive ⇒ Integer

Returns defensive rebounds

Examples:

stat.rebounds_defensive #=> 6

Returns:

  • (Integer) —

    defensive rebounds



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

attribute :rebounds_defensive, Shale::Type::Integer

#rebounds_offensive ⇒ Integer

Returns offensive rebounds

Examples:

stat.rebounds_offensive #=> 1

Returns:

  • (Integer) —

    offensive rebounds



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

attribute :rebounds_offensive, Shale::Type::Integer

#rebounds_total ⇒ Integer

Returns total rebounds

Examples:

stat.rebounds_total #=> 7

Returns:

  • (Integer) —

    total rebounds



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

attribute :rebounds_total, Shale::Type::Integer

#starter ⇒ String

Returns whether the player started

Examples:

stat.starter #=> "1"

Returns:

  • (String) —

    "1" if starter, "0" otherwise



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

attribute :starter, Shale::Type::String

#steals ⇒ Integer

Returns steals

Examples:

stat.steals #=> 2

Returns:

  • (Integer) —

    steals



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

attribute :steals, Shale::Type::Integer

#team_id ⇒ Integer

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer) —

    the team ID



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

attribute :team_id, Shale::Type::Integer

#team_tricode ⇒ String

Returns the team tricode

Examples:

stat.team_tricode #=> "GSW"

Returns:

  • (String) —

    the team tricode



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

attribute :team_tricode, Shale::Type::String

#three_pointers_attempted ⇒ Integer

Returns three-pointers attempted

Examples:

stat.three_pointers_attempted #=> 12

Returns:

  • (Integer) —

    three-pointers attempted



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

attribute :three_pointers_attempted, Shale::Type::Integer

#three_pointers_made ⇒ Integer

Returns three-pointers made

Examples:

stat.three_pointers_made #=> 5

Returns:

  • (Integer) —

    three-pointers made



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

attribute :three_pointers_made, Shale::Type::Integer

#three_pointers_percentage ⇒ Float

Returns three-point percentage

Examples:

stat.three_pointers_percentage #=> 0.417

Returns:

  • (Float) —

    three-point percentage



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

attribute :three_pointers_percentage, Shale::Type::Float

#turnovers ⇒ Integer

Returns turnovers

Examples:

stat.turnovers #=> 3

Returns:

  • (Integer) —

    turnovers



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

attribute :turnovers, Shale::Type::Integer

Instance Method Details

#player ⇒ Player?

Returns the player object

Examples:

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

Returns:

  • (Player, nil) —

    the player object



262
263
264
# File 'lib/nba/live_player_stat.rb', line 262

def player
  Players.find(player_id)
end

#starter? ⇒ Boolean

Returns whether the player was a starter

Examples:

stat.starter? #=> true

Returns:

  • (Boolean) —

    true if starter



252
253
254
# File 'lib/nba/live_player_stat.rb', line 252

def starter?
  starter.eql?("1")
end

#team ⇒ Team?

Returns the team object

Examples:

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

Returns:

  • (Team, nil) —

    the team object



272
273
274
# File 'lib/nba/live_player_stat.rb', line 272

def team
  Teams.find(team_id)
end