Sha256: 6ae9368221c92367ae7c55cdbcbbc4568d5314c0cf51d2a395c04f2d613ca5ec

Contents?: true

Size: 998 Bytes

Versions: 4

Compression:

Stored size: 998 Bytes

Contents

module Sportradar
  module Api
    module Basketball
      class Nba
        class Season < Basketball::Season
          attr_accessor :response, :id, :name, :alias, :year

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

            @id       = data.dig('league', 'id')
            @name     = data.dig('league', 'name')
            @alias    = data.dig('league', 'alias')

            @year     = data.dig('season', 'year')
            @type     = data.dig('season', 'type')

            @games_hash = {}

            update_games(data['games'])
          end

          def games
            @games_hash.values
          end

          def update_games(data)
            create_data(@games_hash, data, klass: Game, api: @api, season: self)
          end

        end
      end
    end
  end
end

__END__

sd = sr.daily_schedule;
sr = Sportradar::Api::Basketball::Nba.new
ss = sr.standings;
ss = sr.schedule;
ss = sr.schedule(2015, 'pst)');

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sportradar-api-0.10.6 lib/sportradar/api/basketball/nba/season.rb
sportradar-api-0.10.5 lib/sportradar/api/basketball/nba/season.rb
sportradar-api-0.10.4 lib/sportradar/api/basketball/nba/season.rb
sportradar-api-0.10.3 lib/sportradar/api/basketball/nba/season.rb