Sha256: 3b4027785ac88563ad3c3772de25c44f9b2bc5ae5484d5ebc2bf72b022a5ac31

Contents?: true

Size: 1.19 KB

Versions: 134

Compression:

Stored size: 1.19 KB

Contents

module Sportradar
  module Api
    module Basketball
      class Ncaamb
        class Half < 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, half: self)
          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.53 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.52 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.51 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.50 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.49 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.48 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.47 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.46 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.45 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.44 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.43 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.42 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.41 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.40 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.39 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.38 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.37 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.36 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.35 lib/sportradar/api/basketball/ncaamb/half.rb
sportradar-api-0.10.34 lib/sportradar/api/basketball/ncaamb/half.rb