lib/sportradar/api/football/play_statistics.rb in sportradar-api-0.11.33 vs lib/sportradar/api/football/play_statistics.rb in sportradar-api-0.11.34
- old
+ new
@@ -6,12 +6,11 @@
def initialize(data)
data = [data] if data.is_a?(Hash)
@response = data
if data.first['name'] # indicates college data structures. we want to convert it to nfl data structures
data.map! do |hash|
- type = self.class.college_type_translations.each_key.detect { |str| hash.key?(str) }
- binding.pry if type.nil?
+ type = self.class.college_type_translations.each_key.detect { |str| hash.key?(str) } || 'misc'
stats = hash.delete(type)
new_team = { 'id' => hash['team'], 'alias' => hash['team'] } # use intermediate variable to avoid temp memory blowup
new_hash = { 'player' => hash, 'team' => new_team, 'stat_type' => self.class.college_type_translations[type] }.merge(stats)
end
end
@@ -51,10 +50,11 @@
"extra_point" => 'extra_point',
"blocked_field_goal_return" => 'block',
"interception_return" => 'return',
"fumble_return" => 'return',
"punt_return" => 'return',
+ "two_point_conversion" => 'conversion',
'misc' => 'misc',
}.freeze
end
def self.stat_type_classes
@@ -337,11 +337,11 @@
class ConversionStatistics < Data
attr_reader :stat_type, :attempt, :complete, :category, :player, :team
def initialize(data)
@response = data
@stat_type = data['stat_type']
- @attempt = data['attempt']
- @complete = data['complete']
+ @attempt = data['attempt'] || data['att']
+ @complete = data['complete'] || data['cmp']
@category = data['category']
@team = OpenStruct.new(data['team']) if data['team']
@player = OpenStruct.new(data['player']) if data['player']
end
end
\ No newline at end of file