Sha256: 4e3444ebefc34f7c61bad3589c4c297e105465dc8f66e6c118632349e45cb964

Contents?: true

Size: 1.09 KB

Versions: 58

Compression:

Stored size: 1.09 KB

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[self.class.period_index]
          @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"]

          if data['pbp']
            opts[:game].update_drives(data['pbp'], quarter: self)
            create_data(@drives_hash, data['pbp'], klass: drive_class, api: api, quarter: self)
          end

          self
        end

        def overtime?
          (@sequence || @number) > 4
        end

        def drives
          @drives_hash.values
        end

        def drive_class
          Drive
        end

      end
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
sportradar-api-0.13.14 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.13 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.12 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.11 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.10 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.9 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.8 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.7 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.6 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.5 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.4 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.3 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.2 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.1 lib/sportradar/api/football/quarter.rb
sportradar-api-0.13.0 lib/sportradar/api/football/quarter.rb
sportradar-api-0.12.3 lib/sportradar/api/football/quarter.rb
sportradar-api-0.12.2 lib/sportradar/api/football/quarter.rb
sportradar-api-0.12.1 lib/sportradar/api/football/quarter.rb