lib/sportradar/api/soccer/player.rb in sportradar-api-0.13.7 vs lib/sportradar/api/soccer/player.rb in sportradar-api-0.13.8
- old
+ new
@@ -8,10 +8,12 @@
def initialize(data = {}, league_group: nil, **opts)
@response = data
@id = data['id'] if data['id']
@api = opts[:api]
+ @team = opts[:team]
+
@league_group = league_group || data['league_group'] || @api&.league_group
update(data, **opts)
end
@@ -34,9 +36,12 @@
@jersey_number = data['jersey_number'] if data['jersey_number']
@preferred_foot = data['preferred_foot'] if data['preferred_foot']
@matches_played = data['matches_played'] if data['matches_played']
@stats = data['statistics'] if data['statistics']
@date_of_birth = Date.parse(data['date_of_birth']) if data['date_of_birth']
+
+ @team.update_player_stats(self, data['statistics'], opts[:game]) if data['statistics'] && @team
+
end
def display_name
@name || [@first_name, @last_name].join(' ')
end