Sha256: c3df00d71c638a7ed28a07afbc2957f4c06c4a0e21d253835cf61482374cb3e3

Contents?: true

Size: 1.23 KB

Versions: 88

Compression:

Stored size: 1.23 KB

Contents

module Sportradar
  module Api
    class Ncaafb
      class Quarter < Data
        attr_accessor :response, :id, :number, :sequence, :home_points, :away_points, :drives

        def initialize(data, **opts)
          @response = data
          @api      = opts[:api]
          @game     = opts[:game]

          @id       = response["id"]
          @number   = response['number']
          @event    = response['event']

          # @number = data["number"]
          # @sequence = data["sequence"]
          # @home_points = data["home_points"]
          # # @home_points = response['scoring']['home']['points'] # from play_by_play
          # @away_points = data["away_points"]
          # # @away_points = response['scoring']['away']['points'] # from play_by_play
          # @drives = parse_into_array(selector: response["play_by_play"]["drive"], klass: Sportradar::Api::Nfl::Drive) if response["play_by_play"] && response["play_by_play"]["drive"]
        end

        def drives
          @drives ||= parse_into_array_with_options(selector: response['drive'], klass: Sportradar::Api::Ncaafb::Drive, api: @api, quarter: self)
        end
        def plays
          @plays ||= drives.flat_map(&:plays)
        end

        private

      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
sportradar-api-0.10.55 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.54 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.53 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.52 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.51 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.50 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.49 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.48 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.47 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.46 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.45 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.44 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.43 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.42 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.41 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.40 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.39 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.38 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.37 lib/sportradar/api/ncaafb/quarter.rb
sportradar-api-0.10.36 lib/sportradar/api/ncaafb/quarter.rb