Sha256: cef75ed3676ab1a01c1c7f1eeb23291ec438564fd13ba81999fec6ab7ae0bd06

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

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

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

          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

17 entries across 17 versions & 1 rubygems

Version Path
sportradar-api-0.12.0 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.69 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.68 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.67 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.66 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.65 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.64 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.63 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.62 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.61 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.60 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.59 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.58 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.57 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.56 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.55 lib/sportradar/api/football/quarter.rb
sportradar-api-0.11.54 lib/sportradar/api/football/quarter.rb