lib/sportradar/api/nfl/drive.rb in sportradar-api-0.9.7 vs lib/sportradar/api/nfl/drive.rb in sportradar-api-0.9.8

- old
+ new

@@ -1,9 +1,9 @@ module Sportradar module Api class Nfl::Drive < Data - attr_accessor :response, :id, :sequence, :start_reason, :end_reason, :play_count, :duration, :first_downs, :gain, :penalty_yards, :scoring_drive, :quarter, :team, :plays + attr_accessor :response, :id, :sequence, :start_reason, :end_reason, :play_count, :duration, :first_downs, :gain, :penalty_yards, :scoring_drive, :quarter, :team, :plays, :events def initialize(data) @response = data @id = data["id"] @sequence = data["sequence"] @@ -17,9 +17,10 @@ @scoring_drive = data["scoring_drive"] @quarter = Sportradar::Api::Nfl::Quarter.new data["quarter"] if data["quarter"] @team = Sportradar::Api::Nfl::Team.new data["team"] if data["team"] @plays = parse_into_array(selector: response["play"], klass: Sportradar::Api::Nfl::Play) if response["play"] @plays ||= parse_into_array(selector: response["plays"]["play"], klass: Sportradar::Api::Nfl::Play) if response["plays"] && response["plays"]["play"] + @events = parse_into_array(selector: response["event"], klass: Sportradar::Api::Nfl::Event) if response["event"] end end end end