lib/sportradar/api/football/quarter.rb in sportradar-api-0.12.0 vs lib/sportradar/api/football/quarter.rb in sportradar-api-0.12.1
- old
+ new
@@ -4,11 +4,11 @@
class Quarter < Data
attr_accessor :response, :api, :id, :number, :sequence, :home_points, :away_points, :scoring
def initialize(data, **opts)
@response = data
- @id = data["number"]
+ @id = data[self.class.period_index]
@api = opts[:api]
@drives_hash = {}
update(data, **opts)
@@ -22,18 +22,18 @@
@home_info = data["home"]
@away_info = data["away"]
if data['pbp']
- opts[:game].update_drives(data['pbp'])
+ opts[:game].update_drives(data['pbp'], quarter: self)
create_data(@drives_hash, data['pbp'], klass: drive_class, api: api, quarter: self)
end
self
end
def overtime?
- @number > 4
+ (@sequence || @number) > 4
end
def drives
@drives_hash.values
end