Class: SportsDataApi::Golf::Season

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/golf/season.rb

Constant Summary collapse

VALID_TOURS =
%i(pga euro).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#tourObject (readonly)

Returns the value of attribute tour.



6
7
8
# File 'lib/sports_data_api/golf/season.rb', line 6

def tour
  @tour
end

#tournamentsObject (readonly)

Returns the value of attribute tournaments.



6
7
8
# File 'lib/sports_data_api/golf/season.rb', line 6

def tournaments
  @tournaments
end

#yearObject (readonly)

Returns the value of attribute year.



6
7
8
# File 'lib/sports_data_api/golf/season.rb', line 6

def year
  @year
end