Sha256: 47a574d6161da57beecca94966986038f4c9bffb83eaadccf3c0e7b747617c2f

Contents?: true

Size: 1.24 KB

Versions: 134

Compression:

Stored size: 1.24 KB

Contents

module Sportradar
  module Api
    module Basketball
      class Nba
        class Quarter < Data
          attr_accessor :response, :id, :game, :number, :sequence, :home_points, :away_points, :drives
          # @all_hash = {}
          # def self.new(data, **opts)
          #   existing = @all_hash[data['id']]
          #   if existing
          #     existing.update(data, **opts)
          #     existing
          #   else
          #     @all_hash[data['id']] = super
          #   end
          # end
          # def self.all
          #   @all_hash.values
          # end

          def initialize(data, **opts)
            @response = data
            @api      = opts[:api]
            # @game     = opts[:game]

            @id       = response["id"]
            @number   = response['number']
            @sequence = response['sequence']

            @plays_hash = {}

            update(data)
          end
          def update(data, **opts)
            create_data(@plays_hash, data.dig('events'), klass: Play, api: @api, quarter: self)
          # rescue => e
          #   binding.pry
          end

          def plays
            @plays_hash.values
          end
          alias :events :plays

          private

        end
      end
    end
  end
end

Version data entries

134 entries across 134 versions & 1 rubygems

Version Path
sportradar-api-0.10.33 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.32 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.31 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.30 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.29 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.28 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.27 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.26 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.25 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.24 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.23 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.22 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.21 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.20 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.19 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.18 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.17 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.16 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.15 lib/sportradar/api/basketball/nba/quarter.rb
sportradar-api-0.10.14 lib/sportradar/api/basketball/nba/quarter.rb