countries 5.2.1 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +4 -2
  3. data/CHANGELOG.md +8 -0
  4. data/lib/countries/cache/countries.json +1 -1
  5. data/lib/countries/cache/locales/tk.json +1 -1
  6. data/lib/countries/country.rb +6 -0
  7. data/lib/countries/data/countries/TM.yaml +1 -1
  8. data/lib/countries/data/subdivisions/AE.yaml +6 -0
  9. data/lib/countries/data/subdivisions/AF.yaml +34 -0
  10. data/lib/countries/data/subdivisions/AG.yaml +8 -0
  11. data/lib/countries/data/subdivisions/AL.yaml +12 -0
  12. data/lib/countries/data/subdivisions/AM.yaml +10 -0
  13. data/lib/countries/data/subdivisions/AO.yaml +18 -0
  14. data/lib/countries/data/subdivisions/AR.yaml +23 -0
  15. data/lib/countries/data/subdivisions/AT.yaml +7 -0
  16. data/lib/countries/data/subdivisions/AU.yaml +8 -0
  17. data/lib/countries/data/subdivisions/AZ.yaml +77 -2
  18. data/lib/countries/data/subdivisions/BA.yaml +3 -0
  19. data/lib/countries/data/subdivisions/BB.yaml +11 -0
  20. data/lib/countries/data/subdivisions/BD.yaml +72 -0
  21. data/lib/countries/data/subdivisions/IR.yaml +31 -1
  22. data/lib/countries/data/subdivisions/KZ.yaml +14 -0
  23. data/lib/countries/data/subdivisions/PY.yaml +1 -1
  24. data/lib/countries/data/subdivisions/TJ.yaml +1 -1
  25. data/lib/countries/data/subdivisions/TM.yaml +1 -1
  26. data/lib/countries/data/subdivisions/UA.yaml +26 -1
  27. data/lib/countries/data/subdivisions/US.yaml +48 -3
  28. data/lib/countries/data/subdivisions/UZ.yaml +13 -1
  29. data/lib/countries/data/translations/countries-tk.yaml +88 -88
  30. data/lib/countries/iso3166.rb +0 -1
  31. data/lib/countries/version.rb +1 -1
  32. data/spec/country_spec.rb +33 -0
  33. metadata +3 -4
  34. 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 Emiratlary
7
+ AE: Birleşen Arap Emirlikleri
8
8
  AF: Owganystan
9
9
  AG: Antigua we Barbuda
10
- AI: Anguilla
10
+ AI: Angwilla
11
11
  AL: Albaniýa
12
12
  AM: Ermenistan
13
13
  AO: Angola
14
- AQ: Antarctica
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 Adalry
21
- AZ: Azerbeýjan
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: Saint Barthélemy
32
- BM: Bermud
31
+ BL: Sen-Bartelmi
32
+ BM: Bermud adalary
33
33
  BN: Bruneý Darussalam
34
34
  BO: Boliwiýa
35
- BQ: Bonaire, Sint Eustatius and Saba
35
+ BQ: Boneýr, Sint-Estatius we Saba
36
36
  BR: Braziliýa
37
- BS: Bahamas
37
+ BS: Bagama adalary
38
38
  BT: Butan
39
- BV: Bouvet Island
39
+ BV: Buwe adasy
40
40
  BW: Botswana
41
41
  BY: Belarus
42
42
  BZ: Beliz
43
43
  CA: Kanada
44
- CC: Cocos (Keeling) Islands
45
- CD: Kongo Demokratik Respublik
46
- CF: Merkezi Afrika Respublikasy
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: Cook Islands
50
+ CK: Kuk adalary
51
51
  CL: Çili
52
52
  CM: Kamerun
53
- CN: China
53
+ CN: Hytaý
54
54
  CO: Kolumbiýa
55
55
  CR: Kosta-Rika
56
56
  CU: Kuba
57
- CV: Cabo Verde
58
- CW: Curaçao
59
- CX: Christmas Island
57
+ CV: Kabo-Werde
58
+ CW: Kürasao
59
+ CX: Roždestwo adalary
60
60
  CY: Kipr
61
- CZ: Czechia
61
+ CZ: Çehiýa
62
62
  DE: Germaniýa
63
63
  DJ: Jibuti
64
64
  DK: Daniýa
65
- DM: Dominiki
66
- DO: Dominakan Respublikasy
67
- DZ: Algerýa
65
+ DM: Dominika
66
+ DO: Dominakan respublikasy
67
+ DZ: Alžyr
68
68
  EC: Ekwador
69
69
  EE: Estoniýa
70
- EG: Egypt
71
- EH: Western Sahara
72
- ER: Eriteriýa
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, Federatiw Ştatlary
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: Guernsey
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: Grek
95
- GS: South Georgia and the South Sandwich Islands
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: Heard Island and McDonald Islands
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: Izrail
109
- IM: Isle of Man
108
+ IL: Izraýyl
109
+ IM: Men adasy
110
110
  IN: Hindistan
111
- IO: British Indian Ocean Territory
112
- IQ: Irak
113
- IR: Eýran, Yslam Respublikasy
114
- IS: Islandia
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: Jersey
116
+ JE: Jersi
117
117
  JM: Ýamaýka
118
- JO: Iordan
118
+ JO: Iordaniýa
119
119
  JP: Ýaponiýa
120
120
  KE: Keniýa
121
- KG: Gyrgyzystan
122
- KH: Kamboçiýa
121
+ KG: Gyrgyzstan
122
+ KH: Kambojiýa
123
123
  KI: Kiribati
124
124
  KM: Komor Adalary
125
- KN: Sent-Kitts we Newis
126
- KP: Koreýa, Halk Demokratik Respublikasy
127
- KR: Koreýa Respublikasy
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: Cayman Islands
129
+ KY: Kaýman adalary
130
130
  KZ: Gazagystan
131
- LA: Lao People's Democratic Republic
131
+ LA: Lao halk demokratik respublikasy
132
132
  LB: Liwan
133
- LC: Sent Lýusiýa
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: Litwiýa
139
- LU: Lýuksenburg
140
- LV: Litwiýa
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: Montenegro
146
- MF: Saint Martin (French part)
145
+ ME: Çernogoriýa
146
+ MF: Sen-Marten (Fransuz tarapy)
147
147
  MG: Madagaskar
148
- MH: Marşalowlar adasy
149
- MK: North Macedonia
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: Northern Mariana Islands
154
+ MP: Demirgazyk Mariana adalary
155
155
  MQ: Martinika
156
156
  MR: Mawritaniýa
157
157
  MS: Montserrat
158
158
  MT: Malta
159
- MU: Mauritius
160
- MV: Maldiwa
159
+ MU: Mawrikiý
160
+ MV: Maldiw adalary
161
161
  MW: Malawi
162
- MX: Meksikanyň
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: French Polynesia
180
+ PF: Fransuz Polineziýa
181
181
  PG: Papua-Täze Gwineýa
182
- PH: Filippinler
183
- PK: Pakystan
182
+ PH: Filippin adalary
183
+ PK: Päkistan
184
184
  PL: Polşa
185
- PM: Sen Pýer we Mikelon
186
- PN: Pitcairn
185
+ PM: Sen-Pýer we Mikelon
186
+ PN: Pitkern
187
187
  PR: Puerto-Riko
188
- PS: Palestine, State of
188
+ PS: Palestina
189
189
  PT: Portugaliýa
190
190
  PW: Palau
191
191
  PY: Paragwaý
192
192
  QA: Katar
193
- RE: Reýunon
193
+ RE: Reýunýon
194
194
  RO: Rumyniýa
195
195
  RS: Serbiýa
196
- RU: Russiýa Federasiýasy
197
- RW: Ruandiýa
198
- SA: Saud Arawiýa
199
- SB: Solomonowlar adasy
200
- SC: Seýşel Adalary
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: Saint Helena, Ascension and Tristan da Cunha
204
+ SH: Mukaddes Ýelena adasy, Wozneseniýe adasy we Tristan-da-Kunýa
205
205
  SI: Sloweniýa
206
- SJ: Svalbard and Jan Mayen
207
- SK: Slowak
208
- SL: Serra-Leone
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: Somalia
211
+ SO: Somali
212
212
  SR: Surinam
213
213
  SS: Günorta Sudan
214
- ST: San-Tome we Prisipi
214
+ ST: San-Tome we Prinsipi
215
215
  SV: Salwador
216
- SX: Sint Maarten (Dutch part)
217
- SY: Siriýa Arap Respublikasy
216
+ SX: Sint-Marten (Golland tarapy)
217
+ SY: Siriýa arap respublikasy
218
218
  SZ: Eswatini
219
- TC: Turks and Caicos Islands
219
+ TC: Turks we Kaikos adalary
220
220
  TD: Çad
221
- TF: French Southern Territories
222
- TG: Togolez
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: Türk
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: United States Minor Outlying Islands
238
- US: Birleşen Ştatlar
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 Dölet-şaheri
242
- VC: Sent-Winsent we Grenadinler
241
+ VA: Watikan döwlet-şäheri
242
+ VC: Sent-Winsent we Grenadin adalary
243
243
  VE: Wenesuela
244
- VG: Wirgin adalary, Britan
245
- VI: Wirgin adalary, ABŞ
244
+ VG: Britan Wirgin adalary
245
+ VI: ABŞ Wirgin adalary
246
246
  VN: Wýetnam
247
247
  VU: Wanuatu
248
- WF: Wallis and Futuna
248
+ WF: Wolles we Futana
249
249
  WS: Samoa
250
250
  YE: Ýemen
251
251
  YT: Maýotta
@@ -3,7 +3,6 @@
3
3
  require 'yaml'
4
4
  require 'json'
5
5
 
6
- require 'countries/kwarg_struct'
7
6
  require 'countries/configuration'
8
7
  require 'countries/data'
9
8
  require 'countries/structure'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Countries
4
- VERSION = '5.2.1'.freeze
4
+ VERSION = '5.3.0'.freeze
5
5
  end
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.2.1
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: 2022-12-22 00:00:00.000000000 Z
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.3.7
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