Class: AhlScraper::SeasonEndDateFetcher
- Inherits:
-
Object
- Object
- AhlScraper::SeasonEndDateFetcher
- Defined in:
- lib/ahl_scraper/fetchers/season_end_date_fetcher.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(season_id, season_type) ⇒ SeasonEndDateFetcher
constructor
A new instance of SeasonEndDateFetcher.
Constructor Details
#initialize(season_id, season_type) ⇒ SeasonEndDateFetcher
Returns a new instance of SeasonEndDateFetcher.
5 6 7 8 |
# File 'lib/ahl_scraper/fetchers/season_end_date_fetcher.rb', line 5 def initialize(season_id, season_type) @season_id = season_id @season_type = season_type end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ahl_scraper/fetchers/season_end_date_fetcher.rb', line 10 def call return if %i[all_star_game exhibition].include? @season_type return SeasonDatesHelper::DATE_EXCEPTIONS[@season_id][:end_date] if SeasonDatesHelper::DATE_EXCEPTIONS.keys.include? @season_id JSON.parse(Nokogiri::HTML(URI.parse(url).open).text[5..-2], symbolize_names: true) &.first &.dig(:sections) &.first &.dig(:data) &.last &.dig(:row, :date_with_day) end |