Class: Sportradar::Nba::Models::PlayPlayerStat
- Inherits:
-
Object
- Object
- Sportradar::Nba::Models::PlayPlayerStat
- Defined in:
- lib/sportradar/nba/models/play_player_stat.rb
Direct Known Subclasses
Instance Method Summary collapse
- #clock ⇒ Object
- #defensive_rebound? ⇒ Boolean
- #description ⇒ Object
- #dunk? ⇒ Boolean
- #event ⇒ Object
- #event_id ⇒ Object
- #free_throw? ⇒ Boolean
- #free_throw_type ⇒ Object
- #full_name ⇒ Object
- #hook? ⇒ Boolean
-
#initialize(event:, attributes:) ⇒ PlayPlayerStat
constructor
A new instance of PlayPlayerStat.
- #jersey ⇒ Object
- #jump_shot? ⇒ Boolean
- #layup? ⇒ Boolean
- #made? ⇒ Boolean
- #offensive_rebound? ⇒ Boolean
- #player ⇒ Object
- #player_id ⇒ Object
- #points ⇒ Object
- #quarter ⇒ Object
- #quarter_abbreviation ⇒ Object
- #quarter_id ⇒ Object
- #quarter_number ⇒ Object
- #quarter_sequence ⇒ Object
- #quarter_type ⇒ Object
- #rebound_type ⇒ Object
- #regular_free_throw? ⇒ Boolean
- #shot_type ⇒ Object
- #shot_type_desc ⇒ Object
- #stat ⇒ Object
- #team ⇒ Object
- #team_id ⇒ Object
- #team_market ⇒ Object
- #team_name ⇒ Object
- #technical_free_throw? ⇒ Boolean
- #three_point_shot? ⇒ Boolean
- #tip? ⇒ Boolean
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(event:, attributes:) ⇒ PlayPlayerStat
Returns a new instance of PlayPlayerStat.
5 6 7 8 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 5 def initialize(event:, attributes:) @event = event @attributes = attributes end |
Instance Method Details
#clock ⇒ Object
57 58 59 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 57 def clock @event.clock end |
#defensive_rebound? ⇒ Boolean
137 138 139 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 137 def defensive_rebound? rebound_type == 'defensive' end |
#description ⇒ Object
29 30 31 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 29 def description @event.description end |
#dunk? ⇒ Boolean
173 174 175 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 173 def dunk? shot_type == 'dunk' end |
#event ⇒ Object
21 22 23 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 21 def event @event end |
#event_id ⇒ Object
25 26 27 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 25 def event_id @event.id end |
#free_throw? ⇒ Boolean
121 122 123 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 121 def free_throw? type == 'freethrow' end |
#free_throw_type ⇒ Object
117 118 119 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 117 def free_throw_type @attributes.dig('free_throw_type') end |
#full_name ⇒ Object
73 74 75 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 73 def full_name player.dig('full_name') end |
#hook? ⇒ Boolean
177 178 179 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 177 def hook? shot_type == 'hook shot' end |
#jersey ⇒ Object
69 70 71 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 69 def jersey player.dig('jersey') end |
#jump_shot? ⇒ Boolean
165 166 167 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 165 def jump_shot? shot_type == 'jump shot' end |
#layup? ⇒ Boolean
169 170 171 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 169 def layup? shot_type == 'layup' end |
#made? ⇒ Boolean
113 114 115 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 113 def made? @attributes.dig('made') == true end |
#offensive_rebound? ⇒ Boolean
141 142 143 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 141 def offensive_rebound? rebound_type == 'offensive' end |
#player ⇒ Object
61 62 63 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 61 def player @attributes.dig('player') || {} end |
#player_id ⇒ Object
65 66 67 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 65 def player_id player.dig('id') end |
#points ⇒ Object
133 134 135 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 133 def points @attributes.dig('points') end |
#quarter ⇒ Object
33 34 35 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 33 def quarter @event.quarter end |
#quarter_abbreviation ⇒ Object
41 42 43 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 41 def quarter_abbreviation quarter.abbreviation end |
#quarter_id ⇒ Object
37 38 39 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 37 def quarter_id quarter.id end |
#quarter_number ⇒ Object
45 46 47 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 45 def quarter_number quarter.number end |
#quarter_sequence ⇒ Object
49 50 51 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 49 def quarter_sequence quarter.sequence end |
#quarter_type ⇒ Object
53 54 55 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 53 def quarter_type quarter.type end |
#rebound_type ⇒ Object
145 146 147 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 145 def rebound_type @attributes.dig('rebound_type') end |
#regular_free_throw? ⇒ Boolean
125 126 127 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 125 def regular_free_throw? free_throw_type == 'regular' end |
#shot_type ⇒ Object
149 150 151 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 149 def shot_type @attributes.dig('shot_type') end |
#shot_type_desc ⇒ Object
153 154 155 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 153 def shot_type_desc @attributes.dig('shot_type_desc') end |
#stat ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# 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 ⇒ Object
77 78 79 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 77 def team @attributes.dig('team') || {} end |
#team_id ⇒ Object
81 82 83 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 81 def team_id team.dig('id') end |
#team_market ⇒ Object
85 86 87 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 85 def team_market team.dig('market') end |
#team_name ⇒ Object
89 90 91 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 89 def team_name team.dig('name') end |
#technical_free_throw? ⇒ Boolean
129 130 131 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 129 def technical_free_throw? free_throw_type == 'technical' end |
#three_point_shot? ⇒ Boolean
157 158 159 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 157 def three_point_shot? @attributes.dig('three_point_shot') == true end |
#tip? ⇒ Boolean
181 182 183 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 181 def tip? shot_type == 'tip shot' end |
#to_s ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# 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 ⇒ Object
161 162 163 |
# File 'lib/sportradar/nba/models/play_player_stat.rb', line 161 def type @attributes.dig('type') end |