Sha256: 211f6f74b30b39790943d8695e40551bc06cf851abac1412c30b9aa6de9c9c38

Contents?: true

Size: 1.36 KB

Versions: 59

Compression:

Stored size: 1.36 KB

Contents

module Sportradar
  module Api
    module Basketball
      class Ncaamb
        class Team < Sportradar::Api::Basketball::Team
          attr_accessor :source, :source_id

          @all_hash = {}
          def self.new(data, **opts)
            existing = @all_hash[data['id']]
            if existing
              existing.update(data, **opts)
              existing
            else
              if data['id']
                @all_hash[data['id']] = super
              else # tournament placeholder
                super.tap do |team|
                  team.source = data['source']
                  team.source_id = data.dig('source', 'id')
                end
              end
            end
          end
          def self.all
            @all_hash.values
          end

          def player_class
            Player
          end

          def api
            @api || Sportradar::Api::Basketball::Ncaamb::Api.new
          end

          def good_guys?
            id == "9b166a3f-e64b-4825-bb6b-92c6f0418263"
          end

        end
      end
    end
  end
end

__END__
ss = sr.schedule;
sd = sr.daily_schedule;
sr = Sportradar::Api::Basketball::Nba.new
lh = sr.league_hierarchy;
t = lh.teams.first;
ss = t.get_season_stats;
g = sd.games.last;
t = g.home;
Sportradar::Api::Basketball::Nba::Team.all.size


# week_count = ss.weeks.count;
# w1 = ss.weeks.first;
# w1 = ss.weeks(1);

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.20.1 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.20.0 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.20.0.pre lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.6 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.5 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.4 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.3 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.2 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.1 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.19.0 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.18.1 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.18.0 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.6 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.5 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.5.pre lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.4 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.3 lib/sportradar/api/basketball/ncaamb/team.rb
sportradar-api-0.17.2 lib/sportradar/api/basketball/ncaamb/team.rb