Sha256: 9821f10a2fa2f69b4a85dda8b055efd2530a432d2307d988566259670fce49c8

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

module Sportradar
  module Api
    module Football
      class Ncaafb
        class Play < Sportradar::Api::Football::Play


          def parsed_ending
            @parsed_ending ||= parse_description_for_drive_end
          end


          def queue_details
            if @details
              url, headers, options, timeout = @api.get_request_info(@details)
              {url: url, headers: headers, params: options, timeout: timeout, callback: method(:update)}
            end
          end

          def get_details
            if @details
              data = @api.get_data(@details).to_h
              update(data)
              data
            end
          end

        private

          def parse_description_for_drive_end
            parsed_ending = case @description
            when /intercepted/i
              :interception
            when /fumbles/i
              :fumble
            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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sportradar-api-0.11.16 lib/sportradar/api/football/ncaafb/play.rb