footballdata-api 0.4.3 → 0.4.5

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: 6712b00c0f67e3c23fbdd0cd9f5436e9683dedc75fa53028cc72a07fa36437e2
4
- data.tar.gz: 8d9ae9147cba11203f2f9755ad1d0a79b52715dab2d03027bdc340a6e4e50d87
3
+ metadata.gz: 4eef9e220606c9f5c1642b1b6f2dbec9aa1ebe1f21b27c79e5f7d6d3f46808f0
4
+ data.tar.gz: b6a3c80beec2d05fec8f5095ef312a7c203c42285b8335ee9c98302c3a17b7ce
5
5
  SHA512:
6
- metadata.gz: b4a5f064656d889e36b352dcedfc77cd503c6f5f2f9ce8fc25a84ac3ece1ecb8acab941a3f21a647e1278f9f87b8e232e1958acca8138b50a6f073351c677856
7
- data.tar.gz: f9bdb77161614d3d381e187aad999f5f0ff67835b920bdd0d31ea553cdab89ab849489f59cb95c98f78088a79cb39a4e9f94d673914048f83b179b6a207dbbc5
6
+ metadata.gz: e8df71833510a8d936b40ab02d49d2a1f16b6d94d2dbd2b8c94bc90fc960c2ee0fb29d5adf74d3645f30a620d8327d9c6ed078b869524503fb9641d5581a849d
7
+ data.tar.gz: '098ed870e9c081485ac45f1cf3a3c697bbc922dd9f96f85ef046b1e1a8829bf07a6041761a10062cc47f28c9471c93bbb93a05f7bcf3c1e99228b438571cdad3'
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.4.3
1
+ ### 0.4.5
2
2
 
3
3
  ### 0.0.1 / 2024-07-03
4
4
 
@@ -38,10 +38,9 @@ STAGES = {
38
38
 
39
39
 
40
40
 
41
- def self.team_autofill( name, teams: )
42
- ## note - no country for place holder teams
43
- return name if name == 'N.N.'
44
41
 
42
+
43
+ def self.find_team_country_code( name, teams: )
45
44
  ## add (fifa) country code e.g.
46
45
  ## Liverpool FC => Liverpool FC (ENG)
47
46
  ## or Liverpool FC => Liverpool FC (URU)
@@ -59,7 +58,7 @@ def self.team_autofill( name, teams: )
59
58
  exit 1
60
59
  end
61
60
 
62
- "#{name} (#{country.code})"
61
+ country.code
63
62
  end
64
63
 
65
64
 
@@ -196,13 +195,6 @@ matches.each do |m|
196
195
  teams[ team1 ] += 1
197
196
  teams[ team2 ] += 1
198
197
 
199
- ####
200
- # auto-add (fifa) country code if int'l club tournament
201
- if clubs_intl
202
- team1 = team_autofill( team1, teams: teams_by_name )
203
- team2 = team_autofill( team2, teams: teams_by_name )
204
- end
205
-
206
198
 
207
199
  ### mods - rename club names
208
200
  unless mods.nil? || mods.empty?
@@ -210,6 +202,22 @@ matches.each do |m|
210
202
  team2 = mods[ team2 ] if mods[ team2 ]
211
203
  end
212
204
 
205
+ ####
206
+ # auto-add (fifa) country code if int'l club tournament
207
+ if clubs_intl
208
+ ## note - use "original" name (not moded) for lookup
209
+ team1_org = m['homeTeam']['name']
210
+ team2_org = m['awayTeam']['name']
211
+ if team1_org ## note - ignore no team/placeholder (e.g. N.N)
212
+ country_code = find_team_country_code( team1_org, teams: teams_by_name )
213
+ team1 = "#{team1} (#{country_code})"
214
+ end
215
+ if team2_org ## note - ignore no team/placeholder (e.g. N.N)
216
+ country_code = find_team_country_code( team2_org, teams: teams_by_name )
217
+ team2 = "#{team2} (#{country_code})"
218
+ end
219
+ end
220
+
213
221
 
214
222
 
215
223
  comments = ''
@@ -221,7 +229,8 @@ matches.each do |m|
221
229
  stats['status'][m['status']] += 1 ## track status counts
222
230
 
223
231
  case m['status']
224
- when 'SCHEDULED', 'TIMED' ## , 'IN_PLAY', 'PAUSED'
232
+ when 'SCHEDULED', 'TIMED',
233
+ 'PAUSED', 'IN_PLAY' ## IN_PLAY, PAUSED
225
234
  ft = ''
226
235
  ht = ''
227
236
  when 'FINISHED'
@@ -12,6 +12,9 @@ module Footballdata
12
12
  'br.1' => {
13
13
  'América FC' => 'América Mineiro', # in year 2018 ??
14
14
  },
15
+ 'copa.l' => {
16
+ 'América FC' => 'América Mineiro', # in year 2022
17
+ },
15
18
  'pt.1' => {
16
19
  'Vitória SC' => 'Vitória Guimarães', ## avoid easy confusion with Vitória SC <=> Vitória FC
17
20
  'Vitória FC' => 'Vitória Setúbal',
@@ -40,7 +40,9 @@ def self.fmt_match( rec )
40
40
  FINISHED
41
41
  POSTPONED
42
42
  AWARDED
43
+ CANCELLED
43
44
  IN_PLAY
45
+ PAUSED
44
46
  ].include?( status ), "unknown status - #{status}" )
45
47
 
46
48
  buf << '%-10s' % status
@@ -2,7 +2,7 @@
2
2
  module FootballdataApi
3
3
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
4
  MINOR = 4
5
- PATCH = 3
5
+ PATCH = 5
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: footballdata-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
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-09-24 00:00:00.000000000 Z
11
+ date: 2024-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: football-timezones