lib/sportradar/api/basketball/game.rb in sportradar-api-0.10.55 vs lib/sportradar/api/basketball/game.rb in sportradar-api-0.11.0
- old
+ new
@@ -78,22 +78,22 @@
m.to_i * 60 + s.to_i
end
def update(data, source: nil, **opts)
# via pbp
- @title = data['title'] if data['title']
@status = data['status'] if data['status']
@coverage = data['coverage'] if data['coverage']
@home_id = data['home_team'] || data.dig('home', 'id') if data['home_team'] || data.dig('home', 'id')
@away_id = data['away_team'] || data.dig('away', 'id') if data['away_team'] || data.dig('away', 'id')
@home_points = data['home_points'].to_i if data['home_points']
@away_points = data['away_points'].to_i if data['away_points']
@scheduled = Time.parse(data["scheduled"]) if data["scheduled"]
@venue = Venue.new(data['venue']) if data['venue']
- @broadcast = Broadcast.new(data['broadcast']) if data['broadcast']
+ @broadcast = Broadcast.new(data['broadcast']) if !data['broadcast'].to_h.empty?
@home = team_class.new(data['home'], api: api, game: self) if data['home']
@away = team_class.new(data['away'], api: api, game: self) if data['away']
+ @title = data['title'] || @title || (home && away && "#{home.full_name} vs #{away.full_name}")
@duration = data['duration'] if data['duration']
@clock = data['clock'] if data['clock']
@attendance = data['attendance'] if data['attendance']
@lead_changes = data['lead_changes'] if data['lead_changes']