lib/sportradar/api/basketball/ncaamb/team.rb in sportradar-api-0.10.3 vs lib/sportradar/api/basketball/ncaamb/team.rb in sportradar-api-0.10.4
- old
+ new
@@ -1,20 +1,25 @@
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
+ 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
\ No newline at end of file