Class: Sportradar::Api::Basketball::Nba::Season
- Defined in:
- lib/sportradar/api/basketball/nba/season.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#response ⇒ Object
Returns the value of attribute response.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #games ⇒ Object
-
#initialize(data, **opts) ⇒ Season
constructor
A new instance of Season.
- #series ⇒ Object
- #update_games(data) ⇒ Object
- #update_series(data) ⇒ Object
Methods inherited from Data
#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data, **opts) ⇒ Season
Returns a new instance of Season.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 8 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 = {} @series_hash = {} update_games(data['games']) if data['games'] update_series(data['series']) if data['series'] end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
6 7 8 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 6 def alias @alias end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 6 def name @name end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 6 def response @response end |
#year ⇒ Object
Returns the value of attribute year.
6 7 8 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 6 def year @year end |
Instance Method Details
#games ⇒ Object
26 27 28 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 26 def games @games_hash.values end |
#series ⇒ Object
34 35 36 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 34 def series @series_hash.values end |
#update_games(data) ⇒ Object
30 31 32 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 30 def update_games(data) create_data(@games_hash, data, klass: Game, api: @api, season: self) end |
#update_series(data) ⇒ Object
38 39 40 |
# File 'lib/sportradar/api/basketball/nba/season.rb', line 38 def update_series(data) create_data(@series_hash, data, klass: Series, api: @api, season: self) end |