lib/sportradar/api/basketball/nba/division.rb in sportradar-api-0.11.69 vs lib/sportradar/api/basketball/nba/division.rb in sportradar-api-0.12.0

- old
+ new

@@ -7,14 +7,21 @@ def initialize(data, **opts) @response = data @api = opts[:api] - @id = data["id"] - @name = data["name"] - @alias = data["alias"] @assigned_teams = nil - @teams_hash = create_data({}, data["teams"], klass: Team, division: self, api: @api) # if response["team"] + @teams_hash = {} + + update(data, **opts) + end + + def update(data, **opts) + @id = data["id"] + @name = data["name"] + @alias = data["alias"] + + create_data(@teams_hash, data["teams"], klass: Team, division: self, api: @api) if response["teams"] end def teams @assigned_teams || @teams_hash.values end