lib/sportradar/api/nfl/quarter.rb in sportradar-api-0.1.31 vs lib/sportradar/api/nfl/quarter.rb in sportradar-api-0.1.32
- old
+ new
@@ -10,10 +10,13 @@
@sequence = data["sequence"]
@home_points = data["home_points"]
# @home_points = response['scoring']['home']['points'] # from play_by_play
@away_points = data["away_points"]
# @away_points = response['scoring']['away']['points'] # from play_by_play
- @drives = data.dig("play_by_play", 'drive')&.map{ |drive| Sportradar::Api::Nfl::Drive.new drive }
+ if (raw_drives = data.dig("play_by_play", 'drive'))
+ raw_drives = raw_drives.is_a?(Hash) ? [ raw_drives ] : raw_drives
+ @drives = raw_drives.map{ |drive| Sportradar::Api::Nfl::Drive.new drive }
+ end
end
end
end
end