Module: AhlScraper::Seasons

Defined in:
lib/ahl_scraper/seasons.rb,
lib/ahl_scraper/resources/seasons/team.rb,
lib/ahl_scraper/services/seasons/teams_service.rb

Defined Under Namespace

Classes: Team, TeamsService

Class Method Summary collapse

Class Method Details

.listObject



12
13
14
15
# File 'lib/ahl_scraper/seasons.rb', line 12

def list
  @season_data ||= SeasonDataFetcher.new.call&.map { |season_data| SeasonListItem.new(season_data) }
  @season_data
end

.retrieve(season_id) ⇒ Object



17
18
19
20
21
# File 'lib/ahl_scraper/seasons.rb', line 17

def retrieve(season_id)
  @season_data ||= SeasonDataFetcher.new.call&.map { |season_data| SeasonListItem.new(season_data) }
  season = @season_data.find { |s| season_id.to_i == s.id }
  Season.new(season)
end

.retrieve_allObject



23
24
25
26
27
28
# File 'lib/ahl_scraper/seasons.rb', line 23

def retrieve_all
  @season_data ||= SeasonDataFetcher.new.call
  @season_data.map do |season|
    Season.new(season)
  end
end