Class: NBA::BoxScoreMatchupStat

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

Overview

Represents a player matchup statistic from the BoxScoreMatchupsV3 endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#comment_defString

Returns the defensive player comment

Examples:

stat.comment_def #=> ""

Returns:

  • (String)

    the defensive player comment



159
# File 'lib/nba/box_score_matchup_stat.rb', line 159

attribute :comment_def, Shale::Type::String

#family_name_defString

Returns the defensive player family name

Examples:

stat.family_name_def #=> "Antetokounmpo"

Returns:

  • (String)

    the defensive player family name



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

attribute :family_name_def, Shale::Type::String

#family_name_offString

Returns the offensive player family name

Examples:

stat.family_name_off #=> "Curry"

Returns:

  • (String)

    the offensive player family name



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

attribute :family_name_off, Shale::Type::String

#first_name_defString

Returns the defensive player first name

Examples:

stat.first_name_def #=> "Giannis"

Returns:

  • (String)

    the defensive player first name



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

attribute :first_name_def, Shale::Type::String

#first_name_offString

Returns the offensive player first name

Examples:

stat.first_name_off #=> "Stephen"

Returns:

  • (String)

    the offensive player first name



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

attribute :first_name_off, Shale::Type::String

#game_idString

Returns the game ID

Examples:

stat.game_id #=> "0022400350"

Returns:

  • (String)

    the game ID



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

attribute :game_id, Shale::Type::String

#help_blocksInteger

Returns the help blocks in the matchup

Examples:

stat.help_blocks #=> 1

Returns:

  • (Integer)

    the help blocks



327
# File 'lib/nba/box_score_matchup_stat.rb', line 327

attribute :help_blocks, Shale::Type::Integer

#help_field_goals_attemptedInteger

Returns the help field goals attempted in the matchup

Examples:

stat.help_field_goals_attempted #=> 4

Returns:

  • (Integer)

    the help field goals attempted



343
# File 'lib/nba/box_score_matchup_stat.rb', line 343

attribute :help_field_goals_attempted, Shale::Type::Integer

#help_field_goals_madeInteger

Returns the help field goals made in the matchup

Examples:

stat.help_field_goals_made #=> 2

Returns:

  • (Integer)

    the help field goals made



335
# File 'lib/nba/box_score_matchup_stat.rb', line 335

attribute :help_field_goals_made, Shale::Type::Integer

#help_field_goals_percentageFloat

Returns the help field goal percentage in the matchup

Examples:

stat.help_field_goals_percentage #=> 0.5

Returns:

  • (Float)

    the help field goal percentage



351
# File 'lib/nba/box_score_matchup_stat.rb', line 351

attribute :help_field_goals_percentage, Shale::Type::Float

#jersey_num_defString

Returns the defensive player jersey number

Examples:

stat.jersey_num_def #=> "34"

Returns:

  • (String)

    the defensive player jersey number



167
# File 'lib/nba/box_score_matchup_stat.rb', line 167

attribute :jersey_num_def, Shale::Type::String

#jersey_num_offString

Returns the offensive player jersey number

Examples:

stat.jersey_num_off #=> "30"

Returns:

  • (String)

    the offensive player jersey number



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

attribute :jersey_num_off, Shale::Type::String

#matchup_assistsInteger

Returns the assists in the matchup

Examples:

stat.matchup_assists #=> 2

Returns:

  • (Integer)

    the matchup assists



247
# File 'lib/nba/box_score_matchup_stat.rb', line 247

attribute :matchup_assists, Shale::Type::Integer

#matchup_blocksInteger

Returns the blocks in the matchup

Examples:

stat.matchup_blocks #=> 0

Returns:

  • (Integer)

    the matchup blocks



271
# File 'lib/nba/box_score_matchup_stat.rb', line 271

attribute :matchup_blocks, Shale::Type::Integer

#matchup_field_goals_attemptedInteger

Returns the field goals attempted in the matchup

Examples:

stat.matchup_field_goals_attempted #=> 6

Returns:

  • (Integer)

    the matchup field goals attempted



287
# File 'lib/nba/box_score_matchup_stat.rb', line 287

attribute :matchup_field_goals_attempted, Shale::Type::Integer

#matchup_field_goals_madeInteger

Returns the field goals made in the matchup

Examples:

stat.matchup_field_goals_made #=> 3

Returns:

  • (Integer)

    the matchup field goals made



279
# File 'lib/nba/box_score_matchup_stat.rb', line 279

attribute :matchup_field_goals_made, Shale::Type::Integer

#matchup_field_goals_percentageFloat

Returns the field goal percentage in the matchup

Examples:

stat.matchup_field_goals_percentage #=> 0.5

Returns:

  • (Float)

    the matchup field goal percentage



295
# File 'lib/nba/box_score_matchup_stat.rb', line 295

attribute :matchup_field_goals_percentage, Shale::Type::Float

#matchup_free_throws_attemptedInteger

Returns the free throws attempted in the matchup

Examples:

stat.matchup_free_throws_attempted #=> 2

Returns:

  • (Integer)

    the matchup free throws attempted



367
# File 'lib/nba/box_score_matchup_stat.rb', line 367

attribute :matchup_free_throws_attempted, Shale::Type::Integer

#matchup_free_throws_madeInteger

Returns the free throws made in the matchup

Examples:

stat.matchup_free_throws_made #=> 2

Returns:

  • (Integer)

    the matchup free throws made



359
# File 'lib/nba/box_score_matchup_stat.rb', line 359

attribute :matchup_free_throws_made, Shale::Type::Integer

#matchup_minutesString

Returns the matchup minutes in display format

Examples:

stat.matchup_minutes #=> "05:30"

Returns:

  • (String)

    the matchup minutes



175
# File 'lib/nba/box_score_matchup_stat.rb', line 175

attribute :matchup_minutes, Shale::Type::String

#matchup_minutes_sortFloat

Returns the matchup minutes as sortable float

Examples:

stat.matchup_minutes_sort #=> 5.5

Returns:

  • (Float)

    the matchup minutes sortable



183
# File 'lib/nba/box_score_matchup_stat.rb', line 183

attribute :matchup_minutes_sort, Shale::Type::Float

#matchup_potential_assistsInteger

Returns the potential assists in the matchup

Examples:

stat.matchup_potential_assists #=> 3

Returns:

  • (Integer)

    the matchup potential assists



255
# File 'lib/nba/box_score_matchup_stat.rb', line 255

attribute :matchup_potential_assists, Shale::Type::Integer

#matchup_three_pointers_attemptedInteger

Returns the three pointers attempted in the matchup

Examples:

stat.matchup_three_pointers_attempted #=> 3

Returns:

  • (Integer)

    the matchup three pointers attempted



311
# File 'lib/nba/box_score_matchup_stat.rb', line 311

attribute :matchup_three_pointers_attempted, Shale::Type::Integer

#matchup_three_pointers_madeInteger

Returns the three pointers made in the matchup

Examples:

stat.matchup_three_pointers_made #=> 1

Returns:

  • (Integer)

    the matchup three pointers made



303
# File 'lib/nba/box_score_matchup_stat.rb', line 303

attribute :matchup_three_pointers_made, Shale::Type::Integer

#matchup_three_pointers_percentageFloat

Returns the three point percentage in the matchup

Examples:

stat.matchup_three_pointers_percentage #=> 0.333

Returns:

  • (Float)

    the matchup three point percentage



319
# File 'lib/nba/box_score_matchup_stat.rb', line 319

attribute :matchup_three_pointers_percentage, Shale::Type::Float

#matchup_turnoversInteger

Returns the turnovers in the matchup

Examples:

stat.matchup_turnovers #=> 1

Returns:

  • (Integer)

    the matchup turnovers



263
# File 'lib/nba/box_score_matchup_stat.rb', line 263

attribute :matchup_turnovers, Shale::Type::Integer

#name_i_defString

Returns the defensive player name initial format

Examples:

stat.name_i_def #=> "G. Antetokounmpo"

Returns:

  • (String)

    the defensive player name initial format



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

attribute :name_i_def, Shale::Type::String

#name_i_offString

Returns the offensive player name initial format

Examples:

stat.name_i_off #=> "S. Curry"

Returns:

  • (String)

    the offensive player name initial format



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

attribute :name_i_off, Shale::Type::String

#partial_possessionsFloat

Returns the partial possessions

Examples:

stat.partial_possessions #=> 12.5

Returns:

  • (Float)

    the partial possessions



191
# File 'lib/nba/box_score_matchup_stat.rb', line 191

attribute :partial_possessions, Shale::Type::Float

#percentage_defender_total_timeFloat

Returns the percentage of defender’s total time

Examples:

stat.percentage_defender_total_time #=> 0.15

Returns:

  • (Float)

    the percentage of defender’s total time



199
# File 'lib/nba/box_score_matchup_stat.rb', line 199

attribute :percentage_defender_total_time, Shale::Type::Float

#percentage_offensive_total_timeFloat

Returns the percentage of offensive player’s total time

Examples:

stat.percentage_offensive_total_time #=> 0.18

Returns:

  • (Float)

    the percentage of offensive player’s total time



207
# File 'lib/nba/box_score_matchup_stat.rb', line 207

attribute :percentage_offensive_total_time, Shale::Type::Float

#percentage_total_time_both_onFloat

Returns the percentage of time both players were on court

Examples:

stat.percentage_total_time_both_on #=> 0.25

Returns:

  • (Float)

    the percentage of time both players were on



215
# File 'lib/nba/box_score_matchup_stat.rb', line 215

attribute :percentage_total_time_both_on, Shale::Type::Float

#person_id_defInteger

Returns the defensive player ID

Examples:

stat.person_id_def #=> 203507

Returns:

  • (Integer)

    the defensive player ID



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

attribute :person_id_def, Shale::Type::Integer

#person_id_offInteger

Returns the offensive player ID

Examples:

stat.person_id_off #=> 201939

Returns:

  • (Integer)

    the offensive player ID



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

attribute :person_id_off, Shale::Type::Integer

#player_pointsInteger

Returns the points scored by the offensive player

Examples:

stat.player_points #=> 8

Returns:

  • (Integer)

    the player points



231
# File 'lib/nba/box_score_matchup_stat.rb', line 231

attribute :player_points, Shale::Type::Integer

#player_slug_defString

Returns the defensive player slug

Examples:

stat.player_slug_def #=> "giannis-antetokounmpo"

Returns:

  • (String)

    the defensive player slug



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

attribute :player_slug_def, Shale::Type::String

#player_slug_offString

Returns the offensive player slug

Examples:

stat.player_slug_off #=> "stephen-curry"

Returns:

  • (String)

    the offensive player slug



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

attribute :player_slug_off, Shale::Type::String

#position_defString

Returns the defensive player position

Examples:

stat.position_def #=> "F"

Returns:

  • (String)

    the defensive player position



151
# File 'lib/nba/box_score_matchup_stat.rb', line 151

attribute :position_def, Shale::Type::String

#shooting_foulsInteger

Returns the shooting fouls drawn in the matchup

Examples:

stat.shooting_fouls #=> 1

Returns:

  • (Integer)

    the shooting fouls



375
# File 'lib/nba/box_score_matchup_stat.rb', line 375

attribute :shooting_fouls, Shale::Type::Integer

#switches_onInteger

Returns the number of switches onto the matchup

Examples:

stat.switches_on #=> 3

Returns:

  • (Integer)

    the switches on



223
# File 'lib/nba/box_score_matchup_stat.rb', line 223

attribute :switches_on, Shale::Type::Integer

#team_cityString

Returns the team city

Examples:

stat.team_city #=> "Golden State"

Returns:

  • (String)

    the team city



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

attribute :team_city, Shale::Type::String

#team_idInteger

Returns the team ID

Examples:

stat.team_id #=> 1610612744

Returns:

  • (Integer)

    the team ID



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

attribute :team_id, Shale::Type::Integer

#team_nameString

Returns the team name

Examples:

stat.team_name #=> "Warriors"

Returns:

  • (String)

    the team name



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

attribute :team_name, Shale::Type::String

#team_pointsInteger

Returns the team points while in matchup

Examples:

stat.team_points #=> 12

Returns:

  • (Integer)

    the team points



239
# File 'lib/nba/box_score_matchup_stat.rb', line 239

attribute :team_points, Shale::Type::Integer

#team_slugString

Returns the team slug

Examples:

stat.team_slug #=> "warriors"

Returns:

  • (String)

    the team slug



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

attribute :team_slug, Shale::Type::String

#team_tricodeString

Returns the team tricode

Examples:

stat.team_tricode #=> "GSW"

Returns:

  • (String)

    the team tricode



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

attribute :team_tricode, Shale::Type::String

Instance Method Details

#defensive_playerPlayer?

Returns the defensive player object

Examples:

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

Returns:

  • (Player, nil)

    the defensive player object



393
394
395
# File 'lib/nba/box_score_matchup_stat.rb', line 393

def defensive_player
  Players.find(person_id_def)
end

#gameGame?

Returns the game object for this matchup

Examples:

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

Returns:

  • (Game, nil)

    the game object



413
414
415
# File 'lib/nba/box_score_matchup_stat.rb', line 413

def game
  Games.find(game_id)
end

#offensive_playerPlayer?

Returns the offensive player object

Examples:

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

Returns:

  • (Player, nil)

    the offensive player object



383
384
385
# File 'lib/nba/box_score_matchup_stat.rb', line 383

def offensive_player
  Players.find(person_id_off)
end

#teamTeam?

Returns the team object

Examples:

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

Returns:

  • (Team, nil)

    the team object



403
404
405
# File 'lib/nba/box_score_matchup_stat.rb', line 403

def team
  Teams.find(team_id)
end