Class: Fbref::Metal

Inherits:
Metal::Base show all
Defined in:
lib/webget-football/fbref/download.rb

Overview

plumbing metal “helpers”

Constant Summary collapse

BASE_URL =
'https://fbref.com/en'

Class Method Summary collapse

Methods inherited from Metal::Base

download_page

Class Method Details

.schedule_url(league:, season:) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/webget-football/fbref/download.rb', line 21

def self.schedule_url( league:, season: )
  season = Season( season )

  pages = LEAGUES[ league ]
  if pages.nil?
    puts "!! ERROR - no pages (urls) configured for league >#{league}<"
    exit 1
  end
  page = pages[ season.key ]
  if pages.nil?
    puts "!! ERROR - no page (url) configured for season >#{season}< for league >#{league}<; available seasons include:"
    pp pages
    exit 1
  end

  "#{BASE_URL}/#{page}"
end