footballdata-api 0.5.0 → 2026.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15d56d22fbf3bfd0f2587ff63f2f3b33b5915ad8122569843f31b99ab21d5f1c
4
- data.tar.gz: e52ee8e33aab078d5c131da9ecd043930a63d638c9e67480f91ea336e2159eb6
3
+ metadata.gz: 285333f5aeaa22a6e531e570f7d41ba43970f73d735e1faca3885d1e0c3387f7
4
+ data.tar.gz: 8e3fddb191ba66045b9c80526d80187b17ec05281603e17a8ea057c1779b6bd8
5
5
  SHA512:
6
- metadata.gz: ff181881d6b90957a8ee865853458b81ae1f6ff3fbb7ae1a3b15d3397a9e94262a21ea9d74d54069fd1a2ca73727fc5dcc4ea407cbfd7ff8cc39c899d20751ec
7
- data.tar.gz: 49ceaa1d080dcd95f7eba336487de96ad7c90a249192e864b822a2a2fd933f6b426c43912b7dcfb365a98be7b40417c395340d0d4fe4ea3250164cdc55170d3c
6
+ metadata.gz: 54da6c832674994199a490fab7a047872f45c43b0e33f399a081e94ab38157168a6882e675fab18790f2a573011fdf8f698b9a8ac3a727af9626cd4794def106
7
+ data.tar.gz: bcff64f55b28e0e62b08d3f7b5e4bf739755c5bf832e6026318935329aebbc82aca3d8e03d7b9a6a49e851b6a7213133a06d7ab4d9c9b5b6bdfddf36596258bc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,4 @@
1
- ### 0.5.0
1
+ ### 2026.7.2
2
2
  ### 0.0.1 / 2024-07-03
3
3
 
4
4
  * Everything is new. First release.
5
-
data/README.md CHANGED
@@ -155,7 +155,7 @@ That's it for now.
155
155
  ## License
156
156
 
157
157
  The `footballdata` scripts are dedicated to the public domain.
158
- Use it as you please with no restrictions whatsoever.
158
+ Use as you please with no restrictions whatsoever.
159
159
 
160
160
 
161
161
  ## Questions? Comments?
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Hoe.spec 'footballdata-api' do
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['football-timezones'],
21
+ ['leagues'],
22
22
  ['fifa'],
23
23
  ['webget'],
24
24
  ]
data/bin/fbdat CHANGED
@@ -190,34 +190,20 @@ end
190
190
  ## note - only use "generic" uniform league codes for now!!
191
191
 
192
192
 
193
+ autofiller = ->(league_query) {
194
+ seasons = find_league_seasons!( league_query ) || []
195
+ seasons[ 0 ] ## assume first is latest season
196
+ }
197
+
198
+
199
+
193
200
  datasets = if opts[:file]
194
- read_leagueset( opts[:file] )
201
+ read_leagueset( opts[:file], autofill: autofiller )
195
202
  else
196
- parse_leagueset_args( args )
203
+ parse_leagueset_args( args, autofill: autofiller )
197
204
  end
198
205
 
199
206
 
200
- ## step 0 - validate and fill-up seasons etc.
201
- datasets.each do |league_key, seasons|
202
- ## todo - find a better name
203
- ## use internal_league_code or such - why? why not?
204
- ### convenience helpers - lets you use eng.1, euro, etc.
205
- ## check if mapping for league_code
206
- metal_league_code = find_league!( league_key )
207
-
208
- ## note - default to latest season of league
209
- ## might be 2024/25 or 2024 or
210
- # for world cup 2022 or such
211
- if seasons.empty?
212
- season = case league_key
213
- when 'world' then Season('2022')
214
- when 'euro' then Season('2024')
215
- when 'br.1', 'copa.l' then Season('2024')
216
- else Season('2024/25')
217
- end
218
- seasons << season
219
- end
220
- end
221
207
 
222
208
  ## step 1 - download
223
209
  datasets.each do |league_key, seasons|
@@ -24,7 +24,7 @@ fr.1, FL1, 2024/25 2023/24 2022/23 2021/22 2020/21
24
24
  it.1, SA, 2024/25 2023/24 2022/23 2021/22 2020/21
25
25
  # SA - Serie A, Italy 15 seasons | 2019-08-24 - 2020-08-02 / matchday 27
26
26
 
27
- br.1, BSA, 2024 2023 2022 2021 2020
27
+ br.1, BSA, 2025 2024 2023 2022 2021 2020
28
28
 
29
29
 
30
30
  ########
@@ -34,7 +34,7 @@ uefa.cl, CL, 2024/25 2023/24 2022/23 2021/22 2020/21
34
34
  ## was europe.cl / cl
35
35
  ## todo/check: use champs and NOT cl - why? why not?
36
36
 
37
- copa.l, CLI, 2024 2023 2022 2021
37
+ copa.l, CLI, 2025 2024 2023 2022 2021
38
38
  ## Copa Libertadores
39
39
 
40
40
 
@@ -67,6 +67,7 @@ def self.convert( league:, season: )
67
67
 
68
68
  season = Season( season ) ## cast (ensure) season class (NOT string, integer, etc.)
69
69
 
70
+ ### note - find_league returns the metal_league_code
70
71
  league_code = find_league!( league )
71
72
 
72
73
  matches_url = Metal.competition_matches_url( league_code, season.start_year )
@@ -76,7 +77,14 @@ def self.convert( league:, season: )
76
77
  data_teams = Webcache.read_json( teams_url )
77
78
 
78
79
 
79
- ## note - for internation club tournaments
80
+ ###
81
+ ## todo/fix - use find_by! - add upstream!!!
82
+ league_info = LeagueCodes.find_by( code: league, season: season )
83
+ ## check for time zone
84
+ tz = league_info['tz']
85
+ pp tz
86
+
87
+ ## note - for international club tournaments
80
88
  ## auto-add (fifa) country code e.g.
81
89
  ## Liverpool FC => Liverpool FC (ENG)
82
90
  ##
@@ -85,10 +93,6 @@ def self.convert( league:, season: )
85
93
  'copa.l'].include?(league.downcase) ? true : false
86
94
 
87
95
 
88
- ## check for time zone
89
- tz = find_zone!( league: league,
90
- season: season )
91
- pp tz
92
96
 
93
97
  ## build a (reverse) team lookup by name
94
98
  puts "#{data_teams['teams'].size} teams"
@@ -66,8 +66,10 @@ class Metal
66
66
  end
67
67
 
68
68
 
69
+ ## note - starting in 2026 requires https !!! (plain http will not work)
70
+ ## resutls in -- 301 Moved Permanently
69
71
 
70
- BASE_URL = 'http://api.football-data.org/v4'
72
+ BASE_URL = 'https://api.football-data.org/v4'
71
73
 
72
74
 
73
75
  def self.competitions_url
@@ -128,4 +130,3 @@ class Metal
128
130
  end
129
131
  end # class Metal
130
132
  end # module Footballdata
131
-
@@ -20,5 +20,32 @@ module Footballdata
20
20
  end
21
21
  code
22
22
  end
23
+
24
+ ###
25
+ # quick (and dirty) hack - return seasons by league code
26
+ # - todo/fix - use one find_league_info method for all or such
27
+ def self.find_league_seasons!( league )
28
+ @league_seasons ||= begin
29
+ recs = read_csv( "#{FootballdataApi.root}/config/leagues_tier1.csv" )
30
+ leagues = {}
31
+ recs.each do |rec|
32
+ leagues[ rec['key'] ] = rec['seasons']
33
+ end
34
+ leagues
35
+ end
36
+
37
+ key = league.downcase
38
+ seasons = @league_seasons[ key ]
39
+ if seasons.nil?
40
+ puts "!! ERROR - no code/mapping found for league >#{league}<"
41
+ puts " mappings include:"
42
+ pp @league_seasons
43
+ exit 1
44
+ end
45
+
46
+ ### split string into array
47
+ seasons = seasons.split( /[ ]+/ )
48
+ seasons
49
+ end
23
50
  end # module Footballdata
24
51
 
@@ -1,8 +1,8 @@
1
1
 
2
2
  module FootballdataApi
3
- MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
- MINOR = 5
5
- PATCH = 0
3
+ MAJOR = 2026 ## todo: namespace inside version or something - why? why not??
4
+ MINOR = 7
5
+ PATCH = 2
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
@@ -17,4 +17,3 @@ module FootballdataApi
17
17
  File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
18
18
  end
19
19
  end # module FootballdataApi
20
-
data/lib/footballdata.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  ## 3rd party (our own)
2
- require 'football/timezones' # note - pulls in season/formats, cocos & tzinfo
2
+ require 'leagues' # note - pulls in season/formats, cocos & tzinfo
3
3
  require 'webget' ## incl. webget, webcache, webclient, etc.
4
4
  require 'fifa'
5
5
 
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: footballdata-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 2026.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-30 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: football-timezones
14
+ name: leagues
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="