class AhlScraper::TeamDataFetcher
Public Class Methods
new(season_id)
click to toggle source
# File lib/ahl_scraper/fetchers/team_data_fetcher.rb, line 5 def initialize(season_id) @season_id = season_id end
Public Instance Methods
call()
click to toggle source
# 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
Private Instance Methods
url()
click to toggle source
# File lib/ahl_scraper/fetchers/team_data_fetcher.rb, line 15 def url "https://lscluster.hockeytech.com/feed/index.php?feed=statviewfeed&view=teams&groupTeamsBy=division&site_id=1&season=#{@season_id}&key=50c2cd9b5e18e390&client_code=ahl&league_id=4&callback=json" # rubocop:disable Layout/LineLength end