lib/sportradar/api/soccer/match.rb in sportradar-api-0.13.2 vs lib/sportradar/api/soccer/match.rb in sportradar-api-0.13.3
- old
+ new
@@ -4,10 +4,11 @@
class Match < Data
attr_reader :id, :league_group, :scheduled, :start_time_tbd, :status, :tournament_round, :match_status, :venue
attr_reader :home_score, :away_score, :winner_id, :aggregate_home_score, :aggregate_away_score, :aggregate_winner_id
attr_reader :referee, :weather_info, :coverage_info, :probabilities
attr_reader :home, :away, :tournament_id
+ attr_reader :clock, :period, :score, :scoring, :broadcast, :coverage # these are for consistency with other sports
def initialize(data = {}, league_group: nil, **opts)
@response = data
@id = data['id']
@api = opts[:api]
@@ -15,10 +16,11 @@
@league_group = league_group || data['league_group'] || @api&.league_group
@timeline_hash = {}
@lineups_hash = {}
get_tournament_id(data, **opts)
+ @scoring_raw = Scoring.new(data, game: self)
@home = Team.new({}, api: api, match: self)
@away = Team.new({}, api: api, match: self)
@teams_hash = { away: @away, home: @home }
update(data, **opts)
@@ -71,9 +73,21 @@
if data['competitors']
update_teams(data['competitors'])
end
# parse_nested_data(data)
+ end
+
+ def title
+ [@home, @away].compact.join(' vs ')
+ end
+
+ def realtime_state
+
+ end
+
+ def scoring
+ @scoring_raw.scores
end
def update_teams(data)
home_hash = data.detect { |team_hash| team_hash["qualifier"] == "home" || team_hash["team"] == "home" }
away_hash = (data - [home_hash]).first