Sha256: 9c45ec8163c809621e60dc59e9cdbf744be099d58ff91052948d986b52ae8a64

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

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

      def initialize(data)
        @response = data
        @id = data["id"]
        @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
        if (raw_drives = data.dig("play_by_play", 'drive'))
          raw_drives = raw_drives.is_a?(Hash) ? [ raw_drives ] : raw_drives
          @drives = raw_drives.map{ |drive| Sportradar::Api::Nfl::Drive.new drive }
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sportradar-api-0.1.34 lib/sportradar/api/nfl/quarter.rb
sportradar-api-0.1.33 lib/sportradar/api/nfl/quarter.rb
sportradar-api-0.1.32 lib/sportradar/api/nfl/quarter.rb