Sha256: e199fec01a38dba8908ea224f443f2cf6a0bbb25524b429975d366e2fd41ec0b

Contents?: true

Size: 998 Bytes

Versions: 16

Compression:

Stored size: 998 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"]

          create_data(@drives_hash, data['pbp'], klass: drive_class, api: api, quarter: self) 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

16 entries across 16 versions & 1 rubygems

Version Path
sportradar-api-0.11.35 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.34 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.33 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.32 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.31 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.30 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.29 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.28 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.27 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.26 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.25 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.24 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.23 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.22 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.21 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.20 lib/sportradar/api/football/quarter.rb