countries 5.2.0 → 5.3.0
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 +4 -4
- data/.github/workflows/tests.yml +5 -3
- data/CHANGELOG.md +34 -2
- data/README.markdown +7 -0
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/tk.json +1 -1
- data/lib/countries/configuration.rb +1 -1
- data/lib/countries/country.rb +6 -0
- data/lib/countries/data/countries/HR.yaml +1 -1
- data/lib/countries/data/countries/TM.yaml +1 -1
- data/lib/countries/data/subdivisions/AE.yaml +6 -0
- data/lib/countries/data/subdivisions/AF.yaml +34 -0
- data/lib/countries/data/subdivisions/AG.yaml +8 -0
- data/lib/countries/data/subdivisions/AL.yaml +12 -0
- data/lib/countries/data/subdivisions/AM.yaml +10 -0
- data/lib/countries/data/subdivisions/AO.yaml +18 -0
- data/lib/countries/data/subdivisions/AR.yaml +23 -0
- data/lib/countries/data/subdivisions/AT.yaml +7 -0
- data/lib/countries/data/subdivisions/AU.yaml +8 -0
- data/lib/countries/data/subdivisions/AZ.yaml +77 -2
- data/lib/countries/data/subdivisions/BA.yaml +3 -0
- data/lib/countries/data/subdivisions/BB.yaml +11 -0
- data/lib/countries/data/subdivisions/BD.yaml +72 -0
- data/lib/countries/data/subdivisions/IR.yaml +31 -1
- data/lib/countries/data/subdivisions/KZ.yaml +14 -0
- data/lib/countries/data/subdivisions/PY.yaml +1 -1
- data/lib/countries/data/subdivisions/TJ.yaml +1 -1
- data/lib/countries/data/subdivisions/TM.yaml +1 -1
- data/lib/countries/data/subdivisions/UA.yaml +26 -1
- data/lib/countries/data/subdivisions/US.yaml +48 -3
- data/lib/countries/data/subdivisions/UZ.yaml +13 -1
- data/lib/countries/data/translations/countries-tk.yaml +88 -88
- data/lib/countries/iso3166.rb +0 -1
- data/lib/countries/version.rb +1 -1
- data/spec/country_spec.rb +33 -0
- metadata +3 -4
- data/lib/countries/kwarg_struct.rb +0 -14
@@ -4,21 +4,21 @@
|
|
4
4
|
#
|
5
5
|
---
|
6
6
|
AD: Andorra
|
7
|
-
AE: Birleşen Arap
|
7
|
+
AE: Birleşen Arap Emirlikleri
|
8
8
|
AF: Owganystan
|
9
9
|
AG: Antigua we Barbuda
|
10
|
-
AI:
|
10
|
+
AI: Angwilla
|
11
11
|
AL: Albaniýa
|
12
12
|
AM: Ermenistan
|
13
13
|
AO: Angola
|
14
|
-
AQ:
|
14
|
+
AQ: Antarktika
|
15
15
|
AR: Argentina
|
16
16
|
AS: Samao Amerika
|
17
17
|
AT: Awstriýa
|
18
18
|
AU: Awstraliýa
|
19
19
|
AW: Aruba
|
20
|
-
AX: Aland
|
21
|
-
AZ:
|
20
|
+
AX: Aland adalary
|
21
|
+
AZ: Äzerbeýjan
|
22
22
|
BA: Bosniýa we Gersogowina
|
23
23
|
BB: Barbados
|
24
24
|
BD: Bangladeş
|
@@ -28,54 +28,54 @@ BG: Bolgariýa
|
|
28
28
|
BH: Bahreýn
|
29
29
|
BI: Burundi
|
30
30
|
BJ: Benin
|
31
|
-
BL:
|
32
|
-
BM: Bermud
|
31
|
+
BL: Sen-Bartelmi
|
32
|
+
BM: Bermud adalary
|
33
33
|
BN: Bruneý Darussalam
|
34
34
|
BO: Boliwiýa
|
35
|
-
BQ:
|
35
|
+
BQ: Boneýr, Sint-Estatius we Saba
|
36
36
|
BR: Braziliýa
|
37
|
-
BS:
|
37
|
+
BS: Bagama adalary
|
38
38
|
BT: Butan
|
39
|
-
BV:
|
39
|
+
BV: Buwe adasy
|
40
40
|
BW: Botswana
|
41
41
|
BY: Belarus
|
42
42
|
BZ: Beliz
|
43
43
|
CA: Kanada
|
44
|
-
CC:
|
45
|
-
CD: Kongo
|
46
|
-
CF: Merkezi
|
44
|
+
CC: Kokos (Kiling) adalary
|
45
|
+
CD: Kongo demokratik respublikasy
|
46
|
+
CF: Merkezi afrika respublikasy
|
47
47
|
CG: Kongo
|
48
48
|
CH: Şweýsariýa
|
49
49
|
CI: Kot-D’’iwuar
|
50
|
-
CK:
|
50
|
+
CK: Kuk adalary
|
51
51
|
CL: Çili
|
52
52
|
CM: Kamerun
|
53
|
-
CN:
|
53
|
+
CN: Hytaý
|
54
54
|
CO: Kolumbiýa
|
55
55
|
CR: Kosta-Rika
|
56
56
|
CU: Kuba
|
57
|
-
CV:
|
58
|
-
CW:
|
59
|
-
CX:
|
57
|
+
CV: Kabo-Werde
|
58
|
+
CW: Kürasao
|
59
|
+
CX: Roždestwo adalary
|
60
60
|
CY: Kipr
|
61
|
-
CZ:
|
61
|
+
CZ: Çehiýa
|
62
62
|
DE: Germaniýa
|
63
63
|
DJ: Jibuti
|
64
64
|
DK: Daniýa
|
65
|
-
DM:
|
66
|
-
DO: Dominakan
|
67
|
-
DZ:
|
65
|
+
DM: Dominika
|
66
|
+
DO: Dominakan respublikasy
|
67
|
+
DZ: Alžyr
|
68
68
|
EC: Ekwador
|
69
69
|
EE: Estoniýa
|
70
|
-
EG:
|
71
|
-
EH:
|
72
|
-
ER:
|
70
|
+
EG: Müsür
|
71
|
+
EH: Günbatar Sahara
|
72
|
+
ER: Eritreýa
|
73
73
|
ES: Ispaniýa
|
74
74
|
ET: Efiopiýa
|
75
75
|
FI: Finlýandiýa
|
76
76
|
FJ: Fiji
|
77
77
|
FK: Folklend (Malwin) adalary
|
78
|
-
FM: Mikroneziýa
|
78
|
+
FM: Mikroneziýa federatiw ştatlary
|
79
79
|
FO: Farer adalary
|
80
80
|
FR: Fransiýa
|
81
81
|
GA: Gabon
|
@@ -83,7 +83,7 @@ GB: Birleşen Patyşalyk
|
|
83
83
|
GD: Grenada
|
84
84
|
GE: Gruziýa
|
85
85
|
GF: Fransuz Gwiana
|
86
|
-
GG:
|
86
|
+
GG: Gernsi
|
87
87
|
GH: Gana
|
88
88
|
GI: Gibraltar
|
89
89
|
GL: Grenlandiýa
|
@@ -91,75 +91,75 @@ GM: Gambiýa
|
|
91
91
|
GN: Gwineýa
|
92
92
|
GP: Gwadelupa
|
93
93
|
GQ: Ekwatorial Gwineýa
|
94
|
-
GR:
|
95
|
-
GS:
|
94
|
+
GR: Gresiýa
|
95
|
+
GS: Günorda Jorjiýa we Günorta Sendwiç adalary
|
96
96
|
GT: Gwatemala
|
97
97
|
GU: Guam
|
98
98
|
GW: Gwineýa-Bisau
|
99
99
|
GY: Gaýana
|
100
100
|
HK: Gonkong
|
101
|
-
HM:
|
101
|
+
HM: Herd adasy we Makdonald adalary
|
102
102
|
HN: Gonduras
|
103
103
|
HR: Horwatiýa
|
104
104
|
HT: Gaiti
|
105
105
|
HU: Wengriýa
|
106
106
|
ID: Indoneziýa
|
107
107
|
IE: Irlandiýa
|
108
|
-
IL:
|
109
|
-
IM:
|
108
|
+
IL: Izraýyl
|
109
|
+
IM: Men adasy
|
110
110
|
IN: Hindistan
|
111
|
-
IO:
|
112
|
-
IQ:
|
113
|
-
IR: Eýran
|
114
|
-
IS:
|
111
|
+
IO: Hindi ummanynyň britan territoriýasy
|
112
|
+
IQ: Yrak
|
113
|
+
IR: Eýran yslam respublikasy
|
114
|
+
IS: Islandiýa
|
115
115
|
IT: Italiýa
|
116
|
-
JE:
|
116
|
+
JE: Jersi
|
117
117
|
JM: Ýamaýka
|
118
|
-
JO:
|
118
|
+
JO: Iordaniýa
|
119
119
|
JP: Ýaponiýa
|
120
120
|
KE: Keniýa
|
121
|
-
KG:
|
122
|
-
KH:
|
121
|
+
KG: Gyrgyzstan
|
122
|
+
KH: Kambojiýa
|
123
123
|
KI: Kiribati
|
124
124
|
KM: Komor Adalary
|
125
|
-
KN: Sent-
|
126
|
-
KP: Koreýa
|
127
|
-
KR: Koreýa
|
125
|
+
KN: Sent-Kits we Newis
|
126
|
+
KP: Koreýa halk demokratik respublikasy
|
127
|
+
KR: Koreýa respublikasy
|
128
128
|
KW: Kuweýt
|
129
|
-
KY:
|
129
|
+
KY: Kaýman adalary
|
130
130
|
KZ: Gazagystan
|
131
|
-
LA: Lao
|
131
|
+
LA: Lao halk demokratik respublikasy
|
132
132
|
LB: Liwan
|
133
|
-
LC: Sent
|
133
|
+
LC: Sent-Lýusiýa
|
134
134
|
LI: Lihtenşteýn
|
135
135
|
LK: Şri-Lanka
|
136
136
|
LR: Liberiýa
|
137
137
|
LS: Lesoto
|
138
|
-
LT:
|
139
|
-
LU:
|
140
|
-
LV:
|
138
|
+
LT: Litwa
|
139
|
+
LU: Lýuksemburg
|
140
|
+
LV: Latwiýa
|
141
141
|
LY: Liwiýa
|
142
142
|
MA: Morokko
|
143
143
|
MC: Monako
|
144
144
|
MD: Moldawiýa
|
145
|
-
ME:
|
146
|
-
MF:
|
145
|
+
ME: Çernogoriýa
|
146
|
+
MF: Sen-Marten (Fransuz tarapy)
|
147
147
|
MG: Madagaskar
|
148
|
-
MH:
|
149
|
-
MK:
|
148
|
+
MH: Marşal adaslary
|
149
|
+
MK: Demirgazyk Makedoniýa
|
150
150
|
ML: Mali
|
151
151
|
MM: Birma
|
152
152
|
MN: Mongoliýa
|
153
153
|
MO: Makao
|
154
|
-
MP:
|
154
|
+
MP: Demirgazyk Mariana adalary
|
155
155
|
MQ: Martinika
|
156
156
|
MR: Mawritaniýa
|
157
157
|
MS: Montserrat
|
158
158
|
MT: Malta
|
159
|
-
MU:
|
160
|
-
MV:
|
159
|
+
MU: Mawrikiý
|
160
|
+
MV: Maldiw adalary
|
161
161
|
MW: Malawi
|
162
|
-
MX:
|
162
|
+
MX: Meksika
|
163
163
|
MY: Malaýziýa
|
164
164
|
MZ: Mozambik
|
165
165
|
NA: Namibiýa
|
@@ -177,49 +177,49 @@ NZ: Täze Zelandiýa
|
|
177
177
|
OM: Oman
|
178
178
|
PA: Panama
|
179
179
|
PE: Peru
|
180
|
-
PF:
|
180
|
+
PF: Fransuz Polineziýa
|
181
181
|
PG: Papua-Täze Gwineýa
|
182
|
-
PH:
|
183
|
-
PK:
|
182
|
+
PH: Filippin adalary
|
183
|
+
PK: Päkistan
|
184
184
|
PL: Polşa
|
185
|
-
PM: Sen
|
186
|
-
PN:
|
185
|
+
PM: Sen-Pýer we Mikelon
|
186
|
+
PN: Pitkern
|
187
187
|
PR: Puerto-Riko
|
188
|
-
PS:
|
188
|
+
PS: Palestina
|
189
189
|
PT: Portugaliýa
|
190
190
|
PW: Palau
|
191
191
|
PY: Paragwaý
|
192
192
|
QA: Katar
|
193
|
-
RE:
|
193
|
+
RE: Reýunýon
|
194
194
|
RO: Rumyniýa
|
195
195
|
RS: Serbiýa
|
196
|
-
RU: Russiýa
|
197
|
-
RW:
|
198
|
-
SA: Saud
|
199
|
-
SB:
|
200
|
-
SC: Seýşel
|
196
|
+
RU: Russiýa federasiýasy
|
197
|
+
RW: Ruanda
|
198
|
+
SA: Saud Arabystan
|
199
|
+
SB: Solomon adalary
|
200
|
+
SC: Seýşel adalary
|
201
201
|
SD: Sudan
|
202
202
|
SE: Şwesiýa
|
203
203
|
SG: Singapur
|
204
|
-
SH:
|
204
|
+
SH: Mukaddes Ýelena adasy, Wozneseniýe adasy we Tristan-da-Kunýa
|
205
205
|
SI: Sloweniýa
|
206
|
-
SJ:
|
207
|
-
SK:
|
208
|
-
SL:
|
206
|
+
SJ: Şpitzbergen we Ýan-Maýen
|
207
|
+
SK: Slowakiýa
|
208
|
+
SL: Siýerra-Leone
|
209
209
|
SM: San-Marino
|
210
210
|
SN: Senegal
|
211
|
-
SO:
|
211
|
+
SO: Somali
|
212
212
|
SR: Surinam
|
213
213
|
SS: Günorta Sudan
|
214
|
-
ST: San-Tome we
|
214
|
+
ST: San-Tome we Prinsipi
|
215
215
|
SV: Salwador
|
216
|
-
SX: Sint
|
217
|
-
SY: Siriýa
|
216
|
+
SX: Sint-Marten (Golland tarapy)
|
217
|
+
SY: Siriýa arap respublikasy
|
218
218
|
SZ: Eswatini
|
219
|
-
TC: Turks
|
219
|
+
TC: Turks we Kaikos adalary
|
220
220
|
TD: Çad
|
221
|
-
TF:
|
222
|
-
TG:
|
221
|
+
TF: Fransuz günorta territoriýalary
|
222
|
+
TG: Togo
|
223
223
|
TH: Taýland
|
224
224
|
TJ: Täjigistan
|
225
225
|
TK: Tokelau
|
@@ -227,25 +227,25 @@ TL: Timor-Leste
|
|
227
227
|
TM: Türkmenistan
|
228
228
|
TN: Tunis
|
229
229
|
TO: Tonga
|
230
|
-
TR:
|
230
|
+
TR: Türkiýe
|
231
231
|
TT: Trinidad we Tobago
|
232
232
|
TV: Tuwalu
|
233
233
|
TW: Taýwan
|
234
234
|
TZ: Tanzaniýa
|
235
235
|
UA: Ukraina
|
236
236
|
UG: Uganda
|
237
|
-
UM:
|
238
|
-
US: Birleşen
|
237
|
+
UM: Kiçi Daş adalarynyň birleşen ştatlary
|
238
|
+
US: Amerikanyň Birleşen Ştatlary
|
239
239
|
UY: Urugwaý
|
240
240
|
UZ: Özbegistan
|
241
|
-
VA: Watikan
|
242
|
-
VC: Sent-Winsent we
|
241
|
+
VA: Watikan döwlet-şäheri
|
242
|
+
VC: Sent-Winsent we Grenadin adalary
|
243
243
|
VE: Wenesuela
|
244
|
-
VG: Wirgin adalary
|
245
|
-
VI: Wirgin adalary
|
244
|
+
VG: Britan Wirgin adalary
|
245
|
+
VI: ABŞ Wirgin adalary
|
246
246
|
VN: Wýetnam
|
247
247
|
VU: Wanuatu
|
248
|
-
WF:
|
248
|
+
WF: Wolles we Futana
|
249
249
|
WS: Samoa
|
250
250
|
YE: Ýemen
|
251
251
|
YT: Maýotta
|
data/lib/countries/iso3166.rb
CHANGED
data/lib/countries/version.rb
CHANGED
data/spec/country_spec.rb
CHANGED
@@ -335,6 +335,26 @@ describe ISO3166::Country do
|
|
335
335
|
end
|
336
336
|
end
|
337
337
|
|
338
|
+
describe 'subdivision_names' do
|
339
|
+
it 'should return an alphabetized list of all subdivisions names' do
|
340
|
+
subdivisions = ISO3166::Country.search('EG').subdivision_names
|
341
|
+
expect(subdivisions).to be_an(Array)
|
342
|
+
expect(subdivisions.first).to be_a(String)
|
343
|
+
expect(subdivisions.size).to eq(27)
|
344
|
+
expect(subdivisions.first).to eq('Alexandria')
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'should return an alphabetized list of subdivision names translated to current locale with codes' do
|
348
|
+
ISO3166.configuration.locales = %i[es de en]
|
349
|
+
|
350
|
+
subdivisions = ISO3166::Country.search('EG').subdivision_names(:es)
|
351
|
+
expect(subdivisions).to be_an(Array)
|
352
|
+
expect(subdivisions.first).to be_a(String)
|
353
|
+
expect(subdivisions.size).to eq(27)
|
354
|
+
expect(subdivisions.first).to eq('Al Iskandariyah')
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
338
358
|
describe 'valid?' do
|
339
359
|
it 'should return true if country is valid' do
|
340
360
|
expect(ISO3166::Country.new('US')).to be_valid
|
@@ -612,6 +632,12 @@ describe ISO3166::Country do
|
|
612
632
|
expect(spain_data.keys).to eq(['ES'])
|
613
633
|
end
|
614
634
|
|
635
|
+
it 'finds country from a subdivision name' do
|
636
|
+
gb_data = ISO3166::Country.find_all_by(:subdivision_names, 'Scotland')
|
637
|
+
expect(gb_data).to be_a Hash
|
638
|
+
expect(gb_data.keys).to eq(['GB'])
|
639
|
+
end
|
640
|
+
|
615
641
|
it 'performs reasonably' do
|
616
642
|
start = Time.now
|
617
643
|
250.times do
|
@@ -700,6 +726,13 @@ describe ISO3166::Country do
|
|
700
726
|
end
|
701
727
|
end
|
702
728
|
|
729
|
+
context "when search name in 'subdivision_names'" do
|
730
|
+
subject { ISO3166::Country.find_by_subdivision_names('Scotland') }
|
731
|
+
it 'should return' do
|
732
|
+
expect(subject.first).to eq('GB')
|
733
|
+
end
|
734
|
+
end
|
735
|
+
|
703
736
|
context "when search name in 'translated_names'" do
|
704
737
|
before do
|
705
738
|
ISO3166.configure do |config|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: countries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Robinson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: unaccent
|
@@ -815,7 +815,6 @@ files:
|
|
815
815
|
- lib/countries/data/translations/countries-zu.yaml
|
816
816
|
- lib/countries/global.rb
|
817
817
|
- lib/countries/iso3166.rb
|
818
|
-
- lib/countries/kwarg_struct.rb
|
819
818
|
- lib/countries/mongoid.rb
|
820
819
|
- lib/countries/sources.rb
|
821
820
|
- lib/countries/sources/cldr/downloader.rb
|
@@ -864,7 +863,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
864
863
|
- !ruby/object:Gem::Version
|
865
864
|
version: '0'
|
866
865
|
requirements: []
|
867
|
-
rubygems_version: 3.
|
866
|
+
rubygems_version: 3.4.2
|
868
867
|
signing_key:
|
869
868
|
specification_version: 4
|
870
869
|
summary: Gives you a country object full of all sorts of useful information.
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ISO3166
|
4
|
-
class KwargStruct < Struct
|
5
|
-
# Override the initialize to handle hashes of named parameters
|
6
|
-
def initialize(*args)
|
7
|
-
opts = args.last.is_a?(Hash) ? args.pop : {}
|
8
|
-
super(*args)
|
9
|
-
opts.each_pair do |k, v|
|
10
|
-
send "#{k}=", v
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|