lib/sportradar/api/basketball/nba/team.rb in sportradar-api-0.10.0 vs lib/sportradar/api/basketball/nba/team.rb in sportradar-api-0.10.1
- old
+ new
@@ -2,9 +2,21 @@
module Api
module Basketball
class Nba
class Team < Sportradar::Api::Basketball::Team
@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 player_class
Player
end
\ No newline at end of file