class Sportradar::Nhl::Models::PlayPlayerStat

Public Class Methods

new(event:, attributes:) click to toggle source
# File lib/sportradar/nhl/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/nhl/models/play_player_stat.rb, line 53
def clock
  @event.clock
end
description() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 29
def description
  @event.description
end
event() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 21
def event
  @event
end
event_id() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 25
def event_id
  @event.id
end
full_name() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 69
def full_name
  player.dig('full_name')
end
goal?() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 104
def goal?
  @attributes.dig('goal') == true
end
jersey() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 65
def jersey
  player.dig('jersey')
end
penalty?() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 108
def penalty?
  type == 'penalty'
end
period() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 33
def period
  @event.period
end
period_abbreviation() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 37
def period_abbreviation
  period.abbreviation
end
period_number() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 41
def period_number
  period.number
end
period_sequence() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 45
def period_sequence
  period.sequence
end
period_type() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 49
def period_type
  period.type
end
player() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 57
def player
  @attributes.dig('player') || {}
end
player_id() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 61
def player_id
  player.dig('id')
end
saved?() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 112
def saved?
  @attributes.dig('saved') == true
end
shootout?() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 116
def shootout?
  @attributes.dig('shootout') == true
end
stat() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 89
def stat
  {
    player_id: player_id,
    period_number: period_number,
    period_type: period_type,
    goal: goal?,
    penalty: penalty?,
    saved: saved?,
    shootout: shootout?,
    strength: strength,
    type: type,
    zone: zone,
  }.compact
end
strength() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 120
def strength
  @attributes.dig('strength')
end
team() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 73
def team
  @attributes.dig('team') || {}
end
team_id() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 77
def team_id
  team.dig('id')
end
team_market() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 81
def team_market
  team.dig('market')
end
team_name() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 85
def team_name
  team.dig('name')
end
to_s() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 10
def to_s
  [
    period_abbreviation,
    clock,
    description,
    team_name,
    full_name,
    stat,
  ].join(' ')
end
type() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 124
def type
  @attributes.dig('type')
end
win?() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 128
def win?
  @attributes.dig('win') == true
end
zone() click to toggle source
# File lib/sportradar/nhl/models/play_player_stat.rb, line 132
def zone
  @attributes.dig('zone')
end