lib/sportradar/api/football/ncaafb/play.rb in sportradar-api-0.11.0 vs lib/sportradar/api/football/ncaafb/play.rb in sportradar-api-0.11.1
- old
+ new
@@ -1,18 +1,40 @@
module Sportradar
module Api
module Football
- class Ncaaf
+ class Ncaafb
class Play < Sportradar::Api::Football::Play
- # def parse_player
- # # TODO: Currently there is an issue where we are only mapping one player_id to a play, but there are plays with multiple players involved.
- # play_stats = @statistics.penalty || @statistics.rush || @statistics.return || @statistics.receive
- # if play_stats.is_a?(Array)
- # play_stats = play_stats.first
- # end
- # @player_id = play_stats&.player&.id
- # end
+
+ def parsed_ending
+ @parsed_ending ||= parse_description_for_drive_end
+ end
+
+ private
+
+ def parse_description_for_drive_end
+ parsed_ending = case @description
+ when /intercepted/i
+ :interception
+ when /extra point is good/i
+ :touchdown
+ # when missed extra point
+ when /punts/i
+ :punt
+ when /Field Goal is No Good. blocked/i
+ :fg
+ # when missed field goal
+ when /Field Goal is Good/i
+ :fg
+ when "End of 1st Half"
+ :end_of_half
+ else
+ #
+ end
+ if parsed_ending
+ parsed_ending
+ end
+ end
end
end
end
end