Module: Footballdata

Defined in:
lib/webget-football/apis/config.rb,
lib/webget-football/apis/leagues.rb,
lib/webget-football/apis/download.rb

Defined Under Namespace

Classes: Configuration, Metal

Constant Summary collapse

LEAGUES =
{
  'eng.1' => 'PL',     # incl. team(s) from wales
  'eng.2' => 'ELC',
   # PL  - Premier League        , England        27 seasons | 2019-08-09 - 2020-07-25 / matchday 31
   #  ELC - Championship          , England         3 seasons | 2019-08-02 - 2020-07-22 / matchday 38
   #
   # 2019 => 2019/20
   # 2018 => 2018/19
   # 2017 => xxx 2017-18 - requires subscription !!!

  'es.1'  => 'PD',
  # PD  - Primera Division      , Spain          27 seasons | 2019-08-16 - 2020-07-19 / matchday 31

  'pt.1'  => 'PPL',
  # PPL - Primeira Liga         , Portugal        9 seasons | 2019-08-10 - 2020-07-26 / matchday 28

  'de.1'  => 'BL1',
  # BL1 - Bundesliga            , Germany        24 seasons | 2019-08-16 - 2020-06-27 / matchday 34

  'nl.1'  => 'DED',
  # DED - Eredivisie            , Netherlands    10 seasons | 2019-08-09 - 2020-03-08 / matchday 34

  'fr.1'  => 'FL1',    # incl. team(s) monaco
  # FL1 - Ligue 1, France
  #   9 seasons | 2019-08-09 - 2020-05-31 / matchday 38
  #
  # 2019 => 2019/20
  # 2018 => 2018/19
  # 2017 => xxx 2017-18 - requires subscription !!!

  'it.1'  => 'SA',
  # SA  - Serie A               , Italy          15 seasons | 2019-08-24 - 2020-08-02 / matchday 27

  'br.1'  => 'BSA',
  # BSA - Série A, Brazil
  #   4 seasons | 2020-05-03 - 2020-12-06 / matchday 10
  #
  #  2020 => 2020
  #  2019 => 2019
  #  2018 => 2018
  #  2017 => xxx 2017 - requires subscription !!!

  ## todo/check: use champs and NOT cl - why? why not?
  'cl'        => 'CL',    ## note: cl is country code for chile!! - use champs - why? why not?
  'europe.cl' => 'CL',    ## note: cl is country code for chile!! - use champs - why? why not?
  # CL  - UEFA Champions League , Europe         19 seasons | 2019-06-25 - 2020-05-30 / matchday 6
}

Class Method Summary collapse

Class Method Details

.configObject



15
# File 'lib/webget-football/apis/config.rb', line 15

def self.config()  @config ||= Configuration.new;  end

.configure {|config| ... } ⇒ Object

lets you use

Footballdata.configure do |config|
   config.convert.out_dir = './o'
end

Yields:



13
# File 'lib/webget-football/apis/config.rb', line 13

def self.configure()  yield( config ); end

.schedule(league:, season:) ⇒ Object

porcelain “api”



6
7
8
9
10
11
12
13
# File 'lib/webget-football/apis/download.rb', line 6

def self.schedule( league:, season: )
  season = Season( season )   ## cast (ensure) season class (NOT string, integer, etc.)

  league_code = LEAGUES[ league.downcase ]

  Metal.teams(   league_code, season.start_year )
  Metal.matches( league_code, season.start_year )
end