Class: Sportradar::Api::Basketball::Ncaamb::Season
- Defined in:
- lib/sportradar/api/basketball/ncaamb/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.
- #tournament(id) ⇒ Object
- #tournaments ⇒ Object
- #update_games(data) ⇒ Object
- #update_tournaments(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 |
# File 'lib/sportradar/api/basketball/ncaamb/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 = {} @tournaments_hash = {} update_games(data['games']) if data['games'] update_tournaments(data['tournaments']) if data['tournaments'] end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
6 7 8 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 6 def alias @alias end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 6 def name @name end |
#response ⇒ Object
Returns the value of attribute response.
6 7 8 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 6 def response @response end |
#year ⇒ Object
Returns the value of attribute year.
6 7 8 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 6 def year @year end |
Instance Method Details
#games ⇒ Object
25 26 27 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 25 def games @games_hash.values end |
#tournament(id) ⇒ Object
33 34 35 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 33 def tournament(id) @tournaments_hash[id] end |
#tournaments ⇒ Object
29 30 31 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 29 def tournaments @tournaments_hash.values end |
#update_games(data) ⇒ Object
37 38 39 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 37 def update_games(data) create_data(@games_hash, data, klass: Game, api: @api, season: self) end |
#update_tournaments(data) ⇒ Object
41 42 43 |
# File 'lib/sportradar/api/basketball/ncaamb/season.rb', line 41 def update_tournaments(data) create_data(@tournaments_hash, data, klass: Tournament, api: @api, season: self) end |