lib/sportradar/api/football/game.rb in sportradar-api-0.11.0 vs lib/sportradar/api/football/game.rb in sportradar-api-0.11.1
- old
+ new
@@ -30,10 +30,14 @@
def timeouts
{}
end
+ def period
+ quarter
+ end
+
def summary_stat(team_id, stat_name)
scoring.dig(team_id, stat_name)
end
def stats(team_id)
team_id.is_a?(Symbol) ? @team_stats[@team_ids[team_id]] : @team_stats[team_id]
@@ -87,11 +91,11 @@
@attendance = data['attendance']
@title = data['title'] || @title || generate_title
# @links = data['links'] ? structure_links(data['links']) : {}
- @teams_hash = { @home.id => @home, @away.id => @away } if @home && @away
+ @teams_hash = { @home.id => @home, @away.id => @away } if @home.id && @away.id
@team_ids = { home: (@home&.id || home_alias), away: (@away&.id || away_alias) }
@scoring_raw.update(data, source: source)
if data['statistics']
@home.update({ 'statistics' => data.dig('statistics', 'home')}, game: self)
@@ -112,12 +116,18 @@
@home.update(data.dig('summary', 'home'), game: self)
@away.update(data.dig('summary', 'away'), game: self)
else
@home.update(data['home_team'], game: self) if data['home_team'].is_a?(Hash)
@away.update(data['away_team'], game: self) if data['away_team'].is_a?(Hash)
- @home_alias = data['home'] if data['home'].is_a?(String) # this might actually be team ID and not alias. check in NFL
- @away_alias = data['away'] if data['away'].is_a?(String) # this might actually be team ID and not alias. check in NFL
+ if data['home'].is_a?(String) # this might actually be team ID and not alias. check in NFL
+ @home_alias = data['home']
+ @home.id ||= @home_alias
+ end
+ if data['away'].is_a?(String) # this might actually be team ID and not alias. check in NFL
+ @away_alias = data['away']
+ @away.id ||= @away_alias
+ end
end
end
# def update_from_team(id, data)
# end
@@ -379,9 +389,14 @@
Sportradar::Api::Football::Quarter
end
def team_class
Team
+ end
+
+ def sim!
+ @api = api.sim!
+ self
end
end
end
end