lib/sportradar/api/football/game.rb in sportradar-api-0.11.35 vs lib/sportradar/api/football/game.rb in sportradar-api-0.11.36
- old
+ new
@@ -21,10 +21,11 @@
@teams_hash = {}
@team_stats = {}
@player_stats = {}
@quarters_hash = {}
+ @drives_hash = {}
@score = {}
update(data, **opts)
end
@@ -156,10 +157,14 @@
end
def update_score(score)
@score.merge!(score)
end
+ def update_drives(data)
+ create_data(@drives_hash, data, klass: drive_class, api: api, game: self)
+ end
+
def leading_team_id
return nil if tied?
score.max_by(&:last).first
end
@@ -203,10 +208,10 @@
end
@pbp ||= quarters
end
def drives
- quarters.flat_map(&:drives).compact
+ @drives_hash.values
end
def plays
drives.flat_map(&:plays).compact
end