Class: SportsDataApi::Golf::Season
- Inherits:
-
Object
- Object
- SportsDataApi::Golf::Season
- Defined in:
- lib/sports_data_api/golf/season.rb
Constant Summary collapse
- VALID_TOURS =
%i(pga euro).freeze
Instance Attribute Summary collapse
-
#tour ⇒ Object
readonly
Returns the value of attribute tour.
-
#tournaments ⇒ Object
readonly
Returns the value of attribute tournaments.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(season_hash) ⇒ Season
constructor
A new instance of Season.
Constructor Details
#initialize(season_hash) ⇒ Season
Returns a new instance of Season.
8 9 10 11 12 13 14 |
# File 'lib/sports_data_api/golf/season.rb', line 8 def initialize(season_hash) @year = season_hash['season']['year'] @tour = season_hash['tour']['alias'].downcase.to_sym @tournaments = season_hash['tournaments'].map do |tournament_hash| Tournament.new(tour, year, tournament_hash) end end |
Instance Attribute Details
#tour ⇒ Object (readonly)
Returns the value of attribute tour.
6 7 8 |
# File 'lib/sports_data_api/golf/season.rb', line 6 def tour @tour end |
#tournaments ⇒ Object (readonly)
Returns the value of attribute tournaments.
6 7 8 |
# File 'lib/sports_data_api/golf/season.rb', line 6 def tournaments @tournaments end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
6 7 8 |
# File 'lib/sports_data_api/golf/season.rb', line 6 def year @year end |