countries 4.2.0 → 4.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -1
- data/LICENSE +3 -1
- data/README.markdown +15 -17
- data/Rakefile +2 -0
- data/countries.gemspec +5 -5
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/cache/locales/oc.json +1 -1
- data/lib/countries/cache/locales/ti.json +1 -1
- data/lib/countries/cache/locales/zu.json +1 -1
- data/lib/countries/configuration.rb +13 -0
- data/lib/countries/country/currency_methods.rb +4 -1
- data/lib/countries/country/emoji.rb +3 -0
- data/lib/countries/country.rb +105 -5
- data/lib/countries/data/countries/AE.yaml +1 -1
- data/lib/countries/data/countries/IL.yaml +0 -2
- data/lib/countries/data/countries/KH.yaml +1 -1
- data/lib/countries/data/countries/TW.yaml +1 -1
- data/lib/countries/data/subdivisions/AD.yaml +21 -21
- data/lib/countries/data/subdivisions/AF.yaml +2 -2
- data/lib/countries/data/subdivisions/AG.yaml +1 -1
- data/lib/countries/data/subdivisions/AI.yaml +98 -98
- data/lib/countries/data/subdivisions/AL.yaml +82 -626
- data/lib/countries/data/subdivisions/AZ.yaml +5 -5
- data/lib/countries/data/subdivisions/BA.yaml +11 -11
- data/lib/countries/data/subdivisions/BD.yaml +8 -8
- data/lib/countries/data/subdivisions/BE.yaml +2 -2
- data/lib/countries/data/subdivisions/BF.yaml +13 -13
- data/lib/countries/data/subdivisions/BI.yaml +3 -3
- data/lib/countries/data/subdivisions/BM.yaml +77 -77
- data/lib/countries/data/subdivisions/BS.yaml +22 -22
- data/lib/countries/data/subdivisions/BW.yaml +7 -7
- data/lib/countries/data/subdivisions/BY.yaml +1 -1
- data/lib/countries/data/subdivisions/CD.yaml +19 -19
- data/lib/countries/data/subdivisions/CG.yaml +1 -1
- data/lib/countries/data/subdivisions/CI.yaml +14 -14
- data/lib/countries/data/subdivisions/CK.yaml +77 -77
- data/lib/countries/data/subdivisions/CN.yaml +0 -107
- data/lib/countries/data/subdivisions/CV.yaml +9 -9
- data/lib/countries/data/subdivisions/DK.yaml +1 -0
- data/lib/countries/data/subdivisions/DO.yaml +11 -11
- data/lib/countries/data/subdivisions/EE.yaml +78 -2
- data/lib/countries/data/subdivisions/EH.yaml +12 -12
- data/lib/countries/data/subdivisions/ES.yaml +17 -17
- data/lib/countries/data/subdivisions/FI.yaml +16 -16
- data/lib/countries/data/subdivisions/FJ.yaml +14 -14
- data/lib/countries/data/subdivisions/GB.yaml +21 -20
- data/lib/countries/data/subdivisions/GH.yaml +7 -7
- data/lib/countries/data/subdivisions/GL.yaml +6 -6
- data/lib/countries/data/subdivisions/GN.yaml +7 -7
- data/lib/countries/data/subdivisions/GQ.yaml +1 -0
- data/lib/countries/data/subdivisions/GR.yaml +1 -1
- data/lib/countries/data/subdivisions/GW.yaml +3 -3
- data/lib/countries/data/subdivisions/HT.yaml +1 -1
- data/lib/countries/data/subdivisions/ID.yaml +41 -41
- data/lib/countries/data/subdivisions/IE.yaml +1 -2
- data/lib/countries/data/subdivisions/IN.yaml +4 -3
- data/lib/countries/data/subdivisions/IQ.yaml +1 -1
- data/lib/countries/data/subdivisions/IR.yaml +2 -1
- data/lib/countries/data/subdivisions/IS.yaml +72 -0
- data/lib/countries/data/subdivisions/IT.yaml +7 -8
- data/lib/countries/data/subdivisions/KG.yaml +1 -1
- data/lib/countries/data/subdivisions/KH.yaml +1 -1
- data/lib/countries/data/subdivisions/KN.yaml +2 -2
- data/lib/countries/data/subdivisions/KP.yaml +12 -12
- data/lib/countries/data/subdivisions/KR.yaml +1 -1
- data/lib/countries/data/subdivisions/KZ.yaml +1 -1
- data/lib/countries/data/subdivisions/LA.yaml +1 -1
- data/lib/countries/data/subdivisions/LB.yaml +2 -2
- data/lib/countries/data/subdivisions/LC.yaml +10 -10
- data/lib/countries/data/subdivisions/LK.yaml +9 -9
- data/lib/countries/data/subdivisions/LR.yaml +2 -2
- data/lib/countries/data/subdivisions/LT.yaml +60 -60
- data/lib/countries/data/subdivisions/LU.yaml +1 -1
- data/lib/countries/data/subdivisions/LV.yaml +1 -1
- data/lib/countries/data/subdivisions/MA.yaml +35 -35
- data/lib/countries/data/subdivisions/MC.yaml +17 -17
- data/lib/countries/data/subdivisions/MD.yaml +740 -740
- data/lib/countries/data/subdivisions/ME.yaml +3 -3
- data/lib/countries/data/subdivisions/MH.yaml +2 -2
- data/lib/countries/data/subdivisions/ML.yaml +2 -2
- data/lib/countries/data/subdivisions/MM.yaml +1 -1
- data/lib/countries/data/subdivisions/MR.yaml +3 -3
- data/lib/countries/data/subdivisions/MV.yaml +8 -8
- data/lib/countries/data/subdivisions/MW.yaml +4 -4
- data/lib/countries/data/subdivisions/MX.yaml +1 -1
- data/lib/countries/data/subdivisions/NL.yaml +6 -6
- data/lib/countries/data/subdivisions/NO.yaml +1 -0
- data/lib/countries/data/subdivisions/NP.yaml +12 -12
- data/lib/countries/data/subdivisions/NZ.yaml +1 -1
- data/lib/countries/data/subdivisions/OM.yaml +6 -6
- data/lib/countries/data/subdivisions/PG.yaml +3 -3
- data/lib/countries/data/subdivisions/PH.yaml +16 -16
- data/lib/countries/data/subdivisions/PK.yaml +2 -2
- data/lib/countries/data/subdivisions/PS.yaml +16 -16
- data/lib/countries/data/subdivisions/QA.yaml +2 -2
- data/lib/countries/data/subdivisions/RS.yaml +2 -2
- data/lib/countries/data/subdivisions/SC.yaml +4 -2
- data/lib/countries/data/subdivisions/SH.yaml +1 -1
- data/lib/countries/data/subdivisions/SI.yaml +19 -19
- data/lib/countries/data/subdivisions/SJ.yaml +14 -14
- data/lib/countries/data/subdivisions/SL.yaml +1 -1
- data/lib/countries/data/subdivisions/SN.yaml +3 -3
- data/lib/countries/data/subdivisions/SS.yaml +10 -10
- data/lib/countries/data/subdivisions/ST.yaml +6 -0
- data/lib/countries/data/subdivisions/TD.yaml +6 -6
- data/lib/countries/data/subdivisions/TH.yaml +1 -1
- data/lib/countries/data/subdivisions/TJ.yaml +2 -2
- data/lib/countries/data/subdivisions/TK.yaml +21 -21
- data/lib/countries/data/subdivisions/TM.yaml +1 -1
- data/lib/countries/data/subdivisions/TT.yaml +2 -2
- data/lib/countries/data/subdivisions/TV.yaml +1 -1
- data/lib/countries/data/subdivisions/TW.yaml +3 -17
- data/lib/countries/data/subdivisions/TZ.yaml +5 -5
- data/lib/countries/data/subdivisions/UG.yaml +59 -52
- data/lib/countries/data/subdivisions/UM.yaml +0 -10
- data/lib/countries/data/subdivisions/WF.yaml +3 -13
- data/lib/countries/data/subdivisions/YE.yaml +3 -3
- data/lib/countries/data/subdivisions/ZA.yaml +2 -2
- data/lib/countries/data/subdivisions/ZM.yaml +1 -1
- data/lib/countries/data.rb +5 -1
- data/lib/countries/global.rb +12 -0
- data/lib/countries/mongoid.rb +3 -0
- data/lib/countries/sources/cldr/downloader.rb +3 -0
- data/lib/countries/sources/cldr/subdivision.rb +1 -0
- data/lib/countries/sources/cldr/subdivision_updater.rb +1 -0
- data/lib/countries/sources/local/cached_loader.rb +2 -0
- data/lib/countries/sources/local/subdivision.rb +1 -0
- data/lib/countries/timezones.rb +4 -2
- data/lib/countries/translations.rb +2 -3
- data/lib/countries/version.rb +1 -1
- metadata +6 -35
- data/lib/countries/data/subdivisions/AS.yaml +0 -85
- data/lib/countries/data/subdivisions/AW.yaml +0 -9
- data/lib/countries/data/subdivisions/AX.yaml +0 -51
- data/lib/countries/data/subdivisions/BL.yaml +0 -11
- data/lib/countries/data/subdivisions/CP.yaml +0 -4
- data/lib/countries/data/subdivisions/CW.yaml +0 -9
- data/lib/countries/data/subdivisions/GF.yaml +0 -11
- data/lib/countries/data/subdivisions/GG.yaml +0 -155
- data/lib/countries/data/subdivisions/GP.yaml +0 -11
- data/lib/countries/data/subdivisions/GU.yaml +0 -275
- data/lib/countries/data/subdivisions/HK.yaml +0 -267
- data/lib/countries/data/subdivisions/IC.yaml +0 -4
- data/lib/countries/data/subdivisions/IM.yaml +0 -337
- data/lib/countries/data/subdivisions/JE.yaml +0 -169
- data/lib/countries/data/subdivisions/MF.yaml +0 -9
- data/lib/countries/data/subdivisions/MO.yaml +0 -9
- data/lib/countries/data/subdivisions/MP.yaml +0 -71
- data/lib/countries/data/subdivisions/MQ.yaml +0 -11
- data/lib/countries/data/subdivisions/MS.yaml +0 -43
- data/lib/countries/data/subdivisions/NC.yaml +0 -57
- data/lib/countries/data/subdivisions/PF.yaml +0 -81
- data/lib/countries/data/subdivisions/PM.yaml +0 -39
- data/lib/countries/data/subdivisions/PR.yaml +0 -1107
- data/lib/countries/data/subdivisions/RE.yaml +0 -11
- data/lib/countries/data/subdivisions/SX.yaml +0 -9
- data/lib/countries/data/subdivisions/TA.yaml +0 -4
- data/lib/countries/data/subdivisions/TF.yaml +0 -67
- data/lib/countries/data/subdivisions/VI.yaml +0 -57
- data/lib/countries/data/subdivisions/YT.yaml +0 -247
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d9b0ecf844c063dc4ce2deeeb02a9fb2832a0640b8ed232b8d2c40ff7061692
|
4
|
+
data.tar.gz: 8969a80a3834eec68f5927dc14aa8470a62c438ec833c8c5a2183e632aabce59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a25098d98189de1f4b74374871559cc78ed42aba67166043d0f9892c8d91a2a8e27c6ab410f26e80a5a02e6bfe79194c4310b3b6e5f7ae0dec61869fdd2ca2
|
7
|
+
data.tar.gz: 3d51bbb186fdda7cc2172d5779d4b4be107ad1295a099894ab8d7f8c6a5b0601a38a03bc8494e017a2234ab081b5b234df913ee94512a6e59d281685c12a09d4
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Change Log
|
2
|
+
|
2
3
|
All notable changes to this project will be documented in this file.
|
3
|
-
This project adheres to [Semantic Versioning](
|
4
|
+
This project adheres to [Semantic Versioning](https://semver.org/).
|
4
5
|
|
5
6
|
## [Future 5.0 release]
|
6
7
|
|
@@ -8,6 +9,34 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
8
9
|
|
9
10
|
- Drop support for Ruby 2.5 and 2.6 [\#708](https://github.com/countries/countries/pull/708) ([pmor](https://github.com/pmor))
|
10
11
|
|
12
|
+
|
13
|
+
## [4.2.3](https://github.com/countries/countries/releases/tag/v4.2.2) (2022/03/24 11:00 +00:00)
|
14
|
+
|
15
|
+
**IMPORTANT NOTE: This will be be the last release of the 4.x series, and the last one to support Ruby 2.5 and 2.6**
|
16
|
+
|
17
|
+
* Use bundle add instead [\#743](https://github.com/countries/countries/pull/743) ([glaucocustodio](https://github.com/glaucocustodio))
|
18
|
+
* update i18n_data [\#742](https://github.com/countries/countries/pull/742) ([bonekost](https://github.com/bonekost))
|
19
|
+
|
20
|
+
## [4.2.2](https://github.com/countries/countries/releases/tag/v4.2.2) (2022/02/17 13:52 +00:00)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
* http:// -> https:// [\#737](https://github.com/countries/countries/pull/737) ([biow0lf](https://github.com/biow0lf))
|
25
|
+
* Update AE start_of_week to monday. [\#739](https://github.com/countries/countries/pull/739) ([pmor](https://github.com/pmor))
|
26
|
+
* Fix Subdivision data by [\#740](https://github.com/countries/countries/pull/740) ([pmor](https://github.com/pmor))
|
27
|
+
|
28
|
+
**Closed issues:**
|
29
|
+
|
30
|
+
* Change on UAE Value.start_of_week [\#738](https://github.com/countries/countries/issues/738)
|
31
|
+
|
32
|
+
|
33
|
+
**Full Changelog**: https://github.com/countries/countries/compare/v4.2.1...v4.2.2
|
34
|
+
|
35
|
+
## [4.2.1](https://github.com/countries/countries/releases/tag/v4.2.1) (2022/01/11 12:39 +00:00)
|
36
|
+
|
37
|
+
- Missing update to cache files on release 4.2.0
|
38
|
+
- Update postal code regexes from rake task [\#734](https://github.com/countries/countries/pull/734 ) ([cover](https://github.com/cover))
|
39
|
+
|
11
40
|
## [4.2.0](https://github.com/countries/countries/releases/tag/v4.2.0) (2022/01/11 11:04 +00:00)
|
12
41
|
|
13
42
|
**Deprecations**
|
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -7,19 +7,15 @@ Countries is a collection of all sorts of useful information for every country i
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
```bash
|
10
|
-
gem install countries
|
11
|
-
```
|
10
|
+
gem install countries
|
11
|
+
```
|
12
12
|
|
13
|
-
Or you can install via Bundler if you are using Rails
|
13
|
+
Or you can install via Bundler if you are using Rails:
|
14
14
|
|
15
|
-
```
|
16
|
-
|
15
|
+
```bash
|
16
|
+
bundle add countries
|
17
17
|
```
|
18
18
|
|
19
|
-
And then execute:
|
20
|
-
|
21
|
-
$ bundle
|
22
|
-
|
23
19
|
## Basic Usage
|
24
20
|
|
25
21
|
Simply load a new country object using Country.new(*alpha2*) or the shortcut Country[*alpha2*]. An example works best.
|
@@ -60,12 +56,11 @@ The `#name` and `#names` attributes, and corresponding finder methods will be re
|
|
60
56
|
|
61
57
|
For translated country names, we use data from [pkg-isocodes](https://salsa.debian.org/iso-codes-team/iso-codes), via the [i18n_data](https://github.com/grosser/i18n_data) gem, and these generally correspond to the expected "common names". These names and the corresponding methods have not been changed.
|
62
58
|
|
63
|
-
|
64
59
|
## Selective Loading of Locales
|
65
60
|
|
66
61
|
As of 2.0 you can selectively load locales to reduce memory usage in production.
|
67
62
|
|
68
|
-
By default we load I18n.available_locales if I18n is present, otherwise only [:en]
|
63
|
+
By default we load `I18n.available_locales` if I18n is present, otherwise only `[:en]`. This means almost any Rails environment will only bring in its supported translations.
|
69
64
|
|
70
65
|
You can add all the locales like this.
|
71
66
|
|
@@ -93,7 +88,7 @@ list = ISO3166::Country.find_all_countries_by_region('Americas')
|
|
93
88
|
c = ISO3166::Country.find_country_by_alpha3('can')
|
94
89
|
```
|
95
90
|
|
96
|
-
For a list of available attributes please see ISO3166::DEFAULT_COUNTRY_HASH
|
91
|
+
For a list of available attributes please see `ISO3166::DEFAULT_COUNTRY_HASH`.
|
97
92
|
Note: searches are *case insensitive and ignore accents*.
|
98
93
|
|
99
94
|
_Please note that `find_by_name`, `find_by_names`, `find_*_by_name` and `find_*_by_names` methods are deprecated and will be removed in 5.0. See [Upgrading to 4.2 and 5.x](#upgrading-to-4-2-and-5-x) above_
|
@@ -154,7 +149,7 @@ c.region # => "Americas"
|
|
154
149
|
c.subregion # => "Northern America"
|
155
150
|
```
|
156
151
|
|
157
|
-
Please note that `latitude_dec` and `longitude_dec`
|
152
|
+
Please note that `latitude_dec` and `longitude_dec` was be deprecated on release 4.2 and will be deleted in 5.0. These attributes have been redundant for several years, since the `latitude` and `longitude` fields have been switched decimal coordinates.
|
158
153
|
|
159
154
|
### Timezones **(optional)**
|
160
155
|
|
@@ -166,8 +161,8 @@ gem 'tzinfo', '~> 1.2', '>= 1.2.2'
|
|
166
161
|
|
167
162
|
```ruby
|
168
163
|
c.timezones.zone_identifiers # => ["America/New_York", "America/Detroit", "America/Kentucky/Louisville", ...]
|
169
|
-
c.timezones.zone_info # see [tzinfo docs](
|
170
|
-
c.timezones # see [tzinfo docs](
|
164
|
+
c.timezones.zone_info # see [tzinfo docs](https://www.rubydoc.info/gems/tzinfo/TZInfo/CountryTimezone)
|
165
|
+
c.timezones # see [tzinfo docs](https://www.rubydoc.info/gems/tzinfo/TZInfo/Country)
|
171
166
|
```
|
172
167
|
|
173
168
|
### Telephone Routing (E164)
|
@@ -241,7 +236,7 @@ c.currency.symbol # => '$'
|
|
241
236
|
|
242
237
|
## Address Formatting
|
243
238
|
|
244
|
-
A template for formatting addresses is available through the address_format method. These templates are compatible with the [Liquid](
|
239
|
+
A template for formatting addresses is available through the address_format method. These templates are compatible with the [Liquid](https://shopify.github.io/liquid/) template system.
|
245
240
|
|
246
241
|
```ruby
|
247
242
|
c.address_format # => "{{recipient}}\n{{street}}\n{{city}} {{region}} {{postalcode}}\n{{country}}"
|
@@ -350,5 +345,8 @@ the next `rake update_cache`.
|
|
350
345
|
|
351
346
|
## Copyright
|
352
347
|
|
353
|
-
Copyright (c)
|
348
|
+
Copyright (c) 2012-2015 hexorx
|
349
|
+
Copyright (c) 2015-2021 hexorx, rposborne
|
350
|
+
Copyright (c) 2022 hexorx, rposborne, pmor
|
354
351
|
|
352
|
+
See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -37,6 +37,8 @@ task :update_cache do
|
|
37
37
|
corrections = YAML.load_file(File.join(File.dirname(__FILE__), 'lib', 'countries', 'data', 'translation_corrections.yaml')) || {}
|
38
38
|
|
39
39
|
language_keys = I18nData.languages.keys + ['zh_CN', 'zh_TW', 'zh_HK','bn_IN','pt_BR']
|
40
|
+
# Ignore locales that have bad data in i18n_data 0.16.0
|
41
|
+
language_keys -= %w[AY AM BA]
|
40
42
|
language_keys.each do |locale|
|
41
43
|
locale = locale.downcase
|
42
44
|
begin
|
data/countries.gemspec
CHANGED
@@ -6,10 +6,10 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ['hexorx@gmail.com', 'russell@burningpony.com', 'pedro@codecreations.tech']
|
7
7
|
gem.description = 'All sorts of useful information about every country packaged as pretty little country objects. It includes data from ISO 3166'
|
8
8
|
gem.summary = 'Gives you a country object full of all sorts of useful information.'
|
9
|
-
gem.homepage = '
|
10
|
-
gem.metadata = { 'bug_tracker_uri' => '
|
11
|
-
'changelog_uri' =>
|
12
|
-
'source_code_uri' =>
|
9
|
+
gem.homepage = 'https://github.com/countries/countries'
|
10
|
+
gem.metadata = { 'bug_tracker_uri' => 'https://github.com/countries/countries/issues',
|
11
|
+
'changelog_uri' => 'https://github.com/countries/countries/blob/master/CHANGELOG.md',
|
12
|
+
'source_code_uri' => 'https://github.com/countries/countries',
|
13
13
|
'wiki_uri' => 'https://github.com/countries/countries/wiki'}
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
21
21
|
|
22
22
|
gem.required_ruby_version = '>= 2.5'
|
23
23
|
|
24
|
-
gem.add_dependency('i18n_data', '~> 0.
|
24
|
+
gem.add_dependency('i18n_data', '~> 0.16.0')
|
25
25
|
gem.add_dependency('sixarm_ruby_unaccent', '~> 1.1')
|
26
26
|
gem.add_development_dependency('rspec', '>= 3')
|
27
27
|
gem.add_development_dependency('activesupport', '>= 3')
|