Class: AhlScraper::SeasonStartDateFetcher
- Inherits:
-
Object
- Object
- AhlScraper::SeasonStartDateFetcher
- Defined in:
- lib/ahl_scraper/fetchers/season_start_date_fetcher.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(season_id, season_type) ⇒ SeasonStartDateFetcher
constructor
A new instance of SeasonStartDateFetcher.
Constructor Details
#initialize(season_id, season_type) ⇒ SeasonStartDateFetcher
Returns a new instance of SeasonStartDateFetcher.
5 6 7 8 |
# File 'lib/ahl_scraper/fetchers/season_start_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_start_date_fetcher.rb', line 10 def call return if %i[all_star_game exhibition].include? @season_type return SeasonDatesHelper::DATE_EXCEPTIONS[@season_id][:start_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) &.first &.dig(:row, :date_with_day) end |