lib/sportradar/api/football/play_statistics.rb in sportradar-api-0.11.27 vs lib/sportradar/api/football/play_statistics.rb in sportradar-api-0.11.28
- old
+ new
@@ -16,11 +16,11 @@
var << klass.new(hash)
end
end
def players
- @players ||= [:kick, :return, :rush, :defense, :receive, :punt, :penalty, :pass, :first_down, :field_goal, :extra_point, :defense, :down_conversion].flat_map do |stat_type|
+ @players ||= [:kick, :return, :rush, :defense, :receive, :punt, :penalty, :pass, :field_goal, :defense, :down_conversion].flat_map do |stat_type|
Array(send(stat_type)).map { |stat| stat.player.team = stat.team.id; stat.player }
end
end
def players_by_team
@@ -67,16 +67,17 @@
@player = OpenStruct.new(data['player']) if data['player']
end
end
class PlayDownConversionStatistics < Data
- attr_accessor :attempt, :complete, :down, :nullified, :team
+ attr_accessor :attempt, :complete, :down, :nullified, :team, :player
def initialize(data)
@attempt = data['attempt']
@complete = data['complete']
@down = data['down']
@team = OpenStruct.new(data['team']) if data['team']
+ @player = OpenStruct.new(data['player']) if data['player']
@nullified = data['nullified']
end
def nullified?
@nullified.to_s == 'true'
@@ -291,11 +292,11 @@
def initialize(data)
@stat_type = data['stat_type']
@attempt = data['attempt']
@complete = data['complete']
@category = data['category']
- @player = data['player']
- @team = data['team']
+ @team = OpenStruct.new(data['team']) if data['team']
+ @player = OpenStruct.new(data['player']) if data['player']
end
end
class PlayReturnStatistics < Data
attr_accessor :category, :downed, :faircatch, :out_of_bounds, :return, :touchback, :yards, :team, :nullified, :player, :touchdown
\ No newline at end of file