Sha256: 431ee03d4c3fc53261c92911730349e3de2934239cc5844290e61324fb93f1ef

Contents?: true

Size: 459 Bytes

Versions: 2

Compression:

Stored size: 459 Bytes

Contents

module SportsDataApi
  module Golf
    class Season
      VALID_TOURS = %i(pga euro).freeze

      attr_reader :year, :tour, :tournaments

      def initialize(season_hash)
        @year = season_hash['season']['year']
        @tour = season_hash['tour']['alias'].downcase.to_sym
        @tournaments = season_hash.fetch('tournaments', []).map do |tournament_hash|
          Tournament.new(tour, year, tournament_hash)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sports_data_api-0.15.3 lib/sports_data_api/golf/season.rb
sports_data_api-0.15.2 lib/sports_data_api/golf/season.rb