Class: AhlScraper::TeamGames::DataFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/ahl_scraper/fetchers/team_games/data_fetcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(team_id, season_id) ⇒ DataFetcher

Returns a new instance of DataFetcher.



6
7
8
9
# File 'lib/ahl_scraper/fetchers/team_games/data_fetcher.rb', line 6

def initialize(team_id, season_id)
  @team_id = team_id
  @season_id = season_id
end

Instance Method Details

#callObject



11
12
13
# File 'lib/ahl_scraper/fetchers/team_games/data_fetcher.rb', line 11

def call
  JSON.parse(Nokogiri::HTML(URI.parse(url).open).text[5..-2], symbolize_names: true)&.dig(0, :sections, 0, :data)
end