Class: AhlScraper::TeamDataFetcher
- Inherits:
-
Object
- Object
- AhlScraper::TeamDataFetcher
- Defined in:
- lib/ahl_scraper/fetchers/team_data_fetcher.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(season_id) ⇒ TeamDataFetcher
constructor
A new instance of TeamDataFetcher.
Constructor Details
#initialize(season_id) ⇒ TeamDataFetcher
Returns a new instance of TeamDataFetcher.
5 6 7 |
# File 'lib/ahl_scraper/fetchers/team_data_fetcher.rb', line 5 def initialize(season_id) @season_id = season_id end |
Instance Method Details
#call ⇒ Object
9 10 11 |
# File 'lib/ahl_scraper/fetchers/team_data_fetcher.rb', line 9 def call JSON.parse(Nokogiri::HTML(URI.parse(url).open).text[5..-2], symbolize_names: true)&.first&.dig(:sections)&.map { |t| t[:data] }&.flatten end |