Sha256: 4ad6ebe504cb83a4899afae5ccec82c94c1e024663892e034841df1c7a97a360

Contents?: true

Size: 953 Bytes

Versions: 18

Compression:

Stored size: 953 Bytes

Contents

module Sportradar
  module Api
    module Football
      class Quarter < Data
        attr_accessor :response, :api, :id, :number, :sequence, :home_points, :away_points, :scoring

        def initialize(data, **opts)
          @response = data
          @id = data["number"]
          @api = opts[:api]

          @drives_hash = {}

          update(data, **opts)
        end

        def update(data, **opts)
          @number       = data["number"]
          @sequence     = data["sequence"]
          @home_points  = data["home_points"]
          @away_points  = data["away_points"]

          @home_info = data["home"]
          @away_info = data["away"]

          opts[:game].update_drives(data['pbp']) if data['pbp']

          self
        end

        def overtime?
          @number > 4
        end

        def drives
          @drives_hash.values
        end

        def drive_class
          Drive
        end

      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sportradar-api-0.11.53 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.52 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.51 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.50 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.49 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.48 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.47 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.46 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.45 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.44 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.43 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.42 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.41 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.40 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.39 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.38 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.37 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.36 lib/sportradar/api/football/quarter.rb