class Sportradar::Nba::Models::PlayPlayerStat

Public Class Methods

new(event:, attributes:) click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 5
def initialize(event:, attributes:)
  @event = event
  @attributes = attributes
end

Public Instance Methods

clock() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 57
def clock
  @event.clock
end
defensive_rebound?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 137
def defensive_rebound?
  rebound_type == 'defensive'
end
description() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 29
def description
  @event.description
end
dunk?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 173
def dunk?
  shot_type == 'dunk'
end
event() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 21
def event
  @event
end
event_id() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 25
def event_id
  @event.id
end
free_throw?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 121
def free_throw?
  type == 'freethrow'
end
free_throw_type() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 117
def free_throw_type
  @attributes.dig('free_throw_type')
end
full_name() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 73
def full_name
  player.dig('full_name')
end
hook?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 177
def hook?
  shot_type == 'hook shot'
end
jersey() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 69
def jersey
  player.dig('jersey')
end
jump_shot?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 165
def jump_shot?
  shot_type == 'jump shot'
end
layup?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 169
def layup?
  shot_type == 'layup'
end
made?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 113
def made?
  @attributes.dig('made') == true
end
offensive_rebound?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 141
def offensive_rebound?
  rebound_type == 'offensive'
end
player() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 61
def player
  @attributes.dig('player') || {}
end
player_id() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 65
def player_id
  player.dig('id')
end
points() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 133
def points
  @attributes.dig('points')
end
quarter() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 33
def quarter
  @event.quarter
end
quarter_abbreviation() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 41
def quarter_abbreviation
  quarter.abbreviation
end
quarter_id() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 37
def quarter_id
  quarter.id
end
quarter_number() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 45
def quarter_number
  quarter.number
end
quarter_sequence() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 49
def quarter_sequence
  quarter.sequence
end
quarter_type() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 53
def quarter_type
  quarter.type
end
rebound_type() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 145
def rebound_type
  @attributes.dig('rebound_type')
end
regular_free_throw?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 125
def regular_free_throw?
  free_throw_type == 'regular'
end
shot_type() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 149
def shot_type
  @attributes.dig('shot_type')
end
shot_type_desc() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 153
def shot_type_desc
  @attributes.dig('shot_type_desc')
end
stat() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 93
def stat
  {
    player_id: player_id,
    team_id: team_id,
    made: made?,
    free_throw_type: free_throw_type,
    free_throw: free_throw?,
    regular_free_throw: regular_free_throw?,
    technical_free_throw: technical_free_throw?,
    points: points,
    rebound_type: rebound_type,
    defensive_rebound: defensive_rebound?,
    offensive_rebound: offensive_rebound?,
    shot_type: shot_type,
    shot_type_desc: shot_type_desc,
    three_point_shot: three_point_shot?,
    type: type,
  }.compact
end
team() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 77
def team
  @attributes.dig('team') || {}
end
team_id() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 81
def team_id
  team.dig('id')
end
team_market() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 85
def team_market
  team.dig('market')
end
team_name() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 89
def team_name
  team.dig('name')
end
technical_free_throw?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 129
def technical_free_throw?
  free_throw_type == 'technical'
end
three_point_shot?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 157
def three_point_shot?
  @attributes.dig('three_point_shot') == true
end
tip?() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 181
def tip?
  shot_type == 'tip shot'
end
to_s() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 10
def to_s
  [
    quarter_abbreviation,
    clock,
    description,
    team_name,
    full_name,
    stat,
  ].join(' ')
end
type() click to toggle source
# File lib/sportradar/nba/models/play_player_stat.rb, line 161
def type
  @attributes.dig('type')
end