lib/sportradar/api/nfl/quarter.rb in sportradar-api-0.1.38 vs lib/sportradar/api/nfl/quarter.rb in sportradar-api-0.9.0
- old
+ new
@@ -10,15 +10,10 @@
@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 = if (raw_drives = data.dig("play_by_play", 'drive'))
- raw_drives = raw_drives.is_a?(Hash) ? [ raw_drives ] : raw_drives
- raw_drives.map{ |drive| Sportradar::Api::Nfl::Drive.new drive }
- else
- []
- end
+ @drives = parse_into_array(selector: response["play_by_play"]["drive"], klass: Sportradar::Api::Nfl::Drive) if response["play_by_play"] && response["play_by_play"]["drive"]
end
end
end
end