countries 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +61 -0
- data/.github/workflows/tests.yml +4 -0
- data/.gitignore +0 -1
- data/.rubocop.yml +17 -8
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -2
- data/Gemfile.lock +84 -0
- data/README.md +41 -1
- data/Rakefile +2 -3
- data/countries.gemspec +1 -1
- data/lib/countries/cache/countries.json +1 -1
- data/lib/countries/country/class_methods.rb +22 -3
- data/lib/countries/country/country_subdivision_methods.rb +82 -0
- data/lib/countries/country/currency_methods.rb +0 -1
- data/lib/countries/country/finder_methods.rb +2 -4
- data/lib/countries/country.rb +13 -53
- data/lib/countries/data/countries/AR.yaml +1 -0
- data/lib/countries/data/countries/AU.yaml +1 -0
- data/lib/countries/data/countries/BR.yaml +1 -0
- data/lib/countries/data/countries/CA.yaml +2 -0
- data/lib/countries/data/countries/CN.yaml +1 -0
- data/lib/countries/data/countries/DE.yaml +2 -0
- data/lib/countries/data/countries/FR.yaml +2 -0
- data/lib/countries/data/countries/GB.yaml +2 -0
- data/lib/countries/data/countries/ID.yaml +1 -0
- data/lib/countries/data/countries/IN.yaml +1 -0
- data/lib/countries/data/countries/IT.yaml +2 -0
- data/lib/countries/data/countries/JP.yaml +2 -0
- data/lib/countries/data/countries/KR.yaml +1 -0
- data/lib/countries/data/countries/MX.yaml +1 -0
- data/lib/countries/data/countries/RU.yaml +1 -0
- data/lib/countries/data/countries/SA.yaml +1 -0
- data/lib/countries/data/countries/TR.yaml +1 -0
- data/lib/countries/data/countries/US.yaml +2 -0
- data/lib/countries/data/countries/ZA.yaml +1 -0
- data/lib/countries/data/locales_methods.rb +23 -0
- data/lib/countries/data/subdivision_methods.rb +30 -0
- data/lib/countries/data/subdivisions/AD.yaml +7 -0
- data/lib/countries/data/subdivisions/AE.yaml +18 -0
- data/lib/countries/data/subdivisions/AF.yaml +167 -2
- data/lib/countries/data/subdivisions/AG.yaml +9 -0
- data/lib/countries/data/subdivisions/AL.yaml +57 -0
- data/lib/countries/data/subdivisions/AM.yaml +34 -0
- data/lib/countries/data/subdivisions/AO.yaml +36 -0
- data/lib/countries/data/subdivisions/AR.yaml +46 -0
- data/lib/countries/data/subdivisions/AT.yaml +28 -0
- data/lib/countries/data/subdivisions/AU.yaml +29 -0
- data/lib/countries/data/subdivisions/AZ.yaml +239 -0
- data/lib/countries/data/subdivisions/BA.yaml +5 -0
- data/lib/countries/data/subdivisions/BB.yaml +4 -0
- data/lib/countries/data/subdivisions/BD.yaml +139 -0
- data/lib/countries/data/subdivisions/BE.yaml +34 -0
- data/lib/countries/data/subdivisions/BF.yaml +56 -0
- data/lib/countries/data/subdivisions/BG.yaml +30 -0
- data/lib/countries/data/subdivisions/BH.yaml +13 -0
- data/lib/countries/data/subdivisions/BI.yaml +54 -0
- data/lib/countries/data/subdivisions/BJ.yaml +22 -0
- data/lib/countries/data/subdivisions/BN.yaml +9 -0
- data/lib/countries/data/subdivisions/BO.yaml +35 -0
- data/lib/countries/data/subdivisions/BQ.yaml +4 -0
- data/lib/countries/data/subdivisions/BR.yaml +14 -0
- data/lib/countries/data/subdivisions/BS.yaml +24 -0
- data/lib/countries/data/subdivisions/BT.yaml +24 -0
- data/lib/countries/data/subdivisions/BW.yaml +24 -0
- data/lib/countries/data/subdivisions/BY.yaml +5 -0
- data/lib/countries/data/subdivisions/BZ.yaml +3 -0
- data/lib/countries/data/subdivisions/CA.yaml +24 -0
- data/lib/countries/data/subdivisions/CD.yaml +77 -0
- data/lib/countries/data/subdivisions/CF.yaml +15 -0
- data/lib/countries/data/subdivisions/CG.yaml +18 -0
- data/lib/countries/data/subdivisions/CH.yaml +92 -0
- data/lib/countries/data/subdivisions/CI.yaml +65 -0
- data/lib/countries/data/subdivisions/CL.yaml +45 -2
- data/lib/countries/data/subdivisions/CM.yaml +22 -0
- data/lib/countries/data/subdivisions/CN.yaml +98 -0
- data/lib/countries/data/subdivisions/CO.yaml +68 -0
- data/lib/countries/data/subdivisions/CR.yaml +14 -0
- data/lib/countries/data/subdivisions/CU.yaml +42 -0
- data/lib/countries/data/subdivisions/CV.yaml +32 -0
- data/lib/countries/data/subdivisions/CY.yaml +18 -0
- data/lib/countries/data/subdivisions/CZ.yaml +227 -0
- data/lib/countries/data/subdivisions/DE.yaml +31 -0
- data/lib/countries/data/subdivisions/DJ.yaml +16 -0
- data/lib/countries/data/subdivisions/DK.yaml +13 -0
- data/lib/countries/data/subdivisions/DM.yaml +1 -0
- data/lib/countries/data/subdivisions/DO.yaml +102 -0
- data/lib/countries/data/subdivisions/DZ.yaml +104 -0
- data/lib/countries/data/subdivisions/EC.yaml +72 -0
- data/lib/countries/data/subdivisions/EE.yaml +6 -0
- data/lib/countries/data/subdivisions/EG.yaml +54 -0
- data/lib/countries/data/subdivisions/ER.yaml +2 -0
- data/lib/countries/data/subdivisions/ES.yaml +252 -0
- data/lib/countries/data/subdivisions/ET.yaml +27 -0
- data/lib/countries/data/subdivisions/FI.yaml +78 -0
- data/lib/countries/data/subdivisions/FJ.yaml +30 -0
- data/lib/countries/data/subdivisions/FM.yaml +11 -0
- data/lib/countries/data/subdivisions/FR.yaml +332 -1
- data/lib/countries/data/subdivisions/GA.yaml +24 -0
- data/lib/countries/data/subdivisions/GB.yaml +488 -0
- data/lib/countries/data/subdivisions/GD.yaml +10 -0
- data/lib/countries/data/subdivisions/GE.yaml +34 -0
- data/lib/countries/data/subdivisions/GH.yaml +79 -0
- data/lib/countries/data/subdivisions/GL.yaml +58 -0
- data/lib/countries/data/subdivisions/GM.yaml +10 -0
- data/lib/countries/data/subdivisions/GN.yaml +65 -0
- data/lib/countries/data/subdivisions/GQ.yaml +36 -0
- data/lib/countries/data/subdivisions/GR.yaml +41 -0
- data/lib/countries/data/subdivisions/GW.yaml +24 -0
- data/lib/countries/data/subdivisions/GY.yaml +31 -0
- data/lib/countries/data/subdivisions/HN.yaml +21 -0
- data/lib/countries/data/subdivisions/HR.yaml +82 -0
- data/lib/countries/data/subdivisions/HT.yaml +14 -0
- data/lib/countries/data/subdivisions/HU.yaml +94 -0
- data/lib/countries/data/subdivisions/ID.yaml +99 -0
- data/lib/countries/data/subdivisions/IE.yaml +39 -0
- data/lib/countries/data/subdivisions/IL.yaml +15 -0
- data/lib/countries/data/subdivisions/IN.yaml +210 -0
- data/lib/countries/data/subdivisions/IQ.yaml +59 -0
- data/lib/countries/data/subdivisions/IR.yaml +2 -0
- data/lib/countries/data/subdivisions/IS.yaml +560 -0
- data/lib/countries/data/subdivisions/IT.yaml +321 -0
- data/lib/countries/data/subdivisions/JM.yaml +22 -0
- data/lib/countries/data/subdivisions/JO.yaml +16 -0
- data/lib/countries/data/subdivisions/JP.yaml +42 -0
- data/lib/countries/data/subdivisions/KE.yaml +298 -0
- data/lib/countries/data/subdivisions/KG.yaml +28 -0
- data/lib/countries/data/subdivisions/KH.yaml +108 -0
- data/lib/countries/data/subdivisions/KI.yaml +6 -0
- data/lib/countries/data/subdivisions/KM.yaml +4 -0
- data/lib/countries/data/subdivisions/KN.yaml +6 -0
- data/lib/countries/data/subdivisions/KP.yaml +42 -0
- data/lib/countries/data/subdivisions/KR.yaml +36 -0
- data/lib/countries/data/subdivisions/KW.yaml +5 -0
- data/lib/countries/data/subdivisions/KZ.yaml +113 -0
- data/lib/countries/data/subdivisions/LA.yaml +49 -0
- data/lib/countries/data/subdivisions/LB.yaml +28 -0
- data/lib/countries/data/subdivisions/LC.yaml +6 -0
- data/lib/countries/data/subdivisions/LI.yaml +37 -0
- data/lib/countries/data/subdivisions/LK.yaml +67 -0
- data/lib/countries/data/subdivisions/LR.yaml +16 -0
- data/lib/countries/data/subdivisions/LS.yaml +23 -0
- data/lib/countries/data/subdivisions/LT.yaml +315 -0
- data/lib/countries/data/subdivisions/LU.yaml +31 -0
- data/lib/countries/data/subdivisions/LV.yaml +83 -0
- data/lib/countries/data/subdivisions/LY.yaml +16 -0
- data/lib/countries/data/subdivisions/MA.yaml +827 -12
- data/lib/countries/data/subdivisions/MC.yaml +47 -0
- data/lib/countries/data/subdivisions/MD.yaml +41 -0
- data/lib/countries/data/subdivisions/ME.yaml +83 -0
- data/lib/countries/data/subdivisions/MG.yaml +21 -0
- data/lib/countries/data/subdivisions/MH.yaml +70 -0
- data/lib/countries/data/subdivisions/MK.yaml +505 -0
- data/lib/countries/data/subdivisions/ML.yaml +33 -0
- data/lib/countries/data/subdivisions/MM.yaml +51 -0
- data/lib/countries/data/subdivisions/MN.yaml +94 -0
- data/lib/countries/data/subdivisions/MR.yaml +32 -0
- data/lib/countries/data/subdivisions/MT.yaml +126 -0
- data/lib/countries/data/subdivisions/MU.yaml +21 -0
- data/lib/countries/data/subdivisions/MV.yaml +20 -0
- data/lib/countries/data/subdivisions/MW.yaml +52 -0
- data/lib/countries/data/subdivisions/MX.yaml +23 -0
- data/lib/countries/data/subdivisions/MY.yaml +24 -0
- data/lib/countries/data/subdivisions/MZ.yaml +20 -0
- data/lib/countries/data/subdivisions/NA.yaml +28 -0
- data/lib/countries/data/subdivisions/NE.yaml +9 -0
- data/lib/countries/data/subdivisions/NG.yaml +89 -0
- data/lib/countries/data/subdivisions/NI.yaml +25 -0
- data/lib/countries/data/subdivisions/NL.yaml +24 -0
- data/lib/countries/data/subdivisions/NO.yaml +138 -1
- data/lib/countries/data/subdivisions/NP.yaml +9 -0
- data/lib/countries/data/subdivisions/NR.yaml +19 -0
- data/lib/countries/data/subdivisions/NZ.yaml +34 -0
- data/lib/countries/data/subdivisions/OM.yaml +10 -0
- data/lib/countries/data/subdivisions/PA.yaml +27 -0
- data/lib/countries/data/subdivisions/PE.yaml +24 -0
- data/lib/countries/data/subdivisions/PG.yaml +46 -0
- data/lib/countries/data/subdivisions/PH.yaml +293 -0
- data/lib/countries/data/subdivisions/PK.yaml +22 -0
- data/lib/countries/data/subdivisions/PL.yaml +141 -0
- data/lib/countries/data/subdivisions/PS.yaml +41 -0
- data/lib/countries/data/subdivisions/PT.yaml +36 -0
- data/lib/countries/data/subdivisions/PW.yaml +24 -0
- data/lib/countries/data/subdivisions/PY.yaml +21 -0
- data/lib/countries/data/subdivisions/QA.yaml +26 -0
- data/lib/countries/data/subdivisions/RO.yaml +189 -0
- data/lib/countries/data/subdivisions/RS.yaml +112 -0
- data/lib/countries/data/subdivisions/RU.yaml +123 -0
- data/lib/countries/data/subdivisions/RW.yaml +7 -0
- data/lib/countries/data/subdivisions/SA.yaml +38 -0
- data/lib/countries/data/subdivisions/SB.yaml +11 -0
- data/lib/countries/data/subdivisions/SC.yaml +45 -0
- data/lib/countries/data/subdivisions/SD.yaml +15 -0
- data/lib/countries/data/subdivisions/SE.yaml +42 -0
- data/lib/countries/data/subdivisions/SG.yaml +8 -0
- data/lib/countries/data/subdivisions/SH.yaml +6 -0
- data/lib/countries/data/subdivisions/SI.yaml +735 -0
- data/lib/countries/data/subdivisions/SK.yaml +22 -0
- data/lib/countries/data/subdivisions/SL.yaml +7 -0
- data/lib/countries/data/subdivisions/SM.yaml +19 -0
- data/lib/countries/data/subdivisions/SN.yaml +43 -0
- data/lib/countries/data/subdivisions/SO.yaml +71 -0
- data/lib/countries/data/subdivisions/SR.yaml +17 -0
- data/lib/countries/data/subdivisions/SS.yaml +4 -0
- data/lib/countries/data/subdivisions/ST.yaml +127 -0
- data/lib/countries/data/subdivisions/SV.yaml +20 -0
- data/lib/countries/data/subdivisions/SY.yaml +53 -0
- data/lib/countries/data/subdivisions/SZ.yaml +18 -0
- data/lib/countries/data/subdivisions/TD.yaml +51 -0
- data/lib/countries/data/subdivisions/TG.yaml +13 -0
- data/lib/countries/data/subdivisions/TH.yaml +231 -0
- data/lib/countries/data/subdivisions/TJ.yaml +15 -0
- data/lib/countries/data/subdivisions/TL.yaml +38 -0
- data/lib/countries/data/subdivisions/TM.yaml +15 -0
- data/lib/countries/data/subdivisions/TN.yaml +25 -0
- data/lib/countries/data/subdivisions/TO.yaml +1 -0
- data/lib/countries/data/subdivisions/TR.yaml +93 -0
- data/lib/countries/data/subdivisions/TT.yaml +25 -0
- data/lib/countries/data/subdivisions/TV.yaml +25 -0
- data/lib/countries/data/subdivisions/TW.yaml +106 -0
- data/lib/countries/data/subdivisions/TZ.yaml +38 -0
- data/lib/countries/data/subdivisions/UA.yaml +86 -4
- data/lib/countries/data/subdivisions/UG.yaml +262 -0
- data/lib/countries/data/subdivisions/UM.yaml +4 -0
- data/lib/countries/data/subdivisions/US.yaml +118 -0
- data/lib/countries/data/subdivisions/UY.yaml +27 -0
- data/lib/countries/data/subdivisions/UZ.yaml +65 -0
- data/lib/countries/data/subdivisions/VC.yaml +6 -0
- data/lib/countries/data/subdivisions/VE.yaml +33 -0
- data/lib/countries/data/subdivisions/VN.yaml +131 -0
- data/lib/countries/data/subdivisions/VU.yaml +8 -0
- data/lib/countries/data/subdivisions/WS.yaml +18 -0
- data/lib/countries/data/subdivisions/YE.yaml +16 -0
- data/lib/countries/data/subdivisions/ZA.yaml +5 -0
- data/lib/countries/data/subdivisions/ZM.yaml +24 -0
- data/lib/countries/data/subdivisions/ZW.yaml +21 -0
- data/lib/countries/data.rb +19 -50
- data/lib/countries/global.rb +0 -1
- data/lib/countries/iso3166.rb +3 -0
- data/lib/countries/sources/cldr/subdivision.rb +1 -1
- data/lib/countries/subdivision.rb +5 -0
- data/lib/countries/tasks/postal_codes.rake +5 -1
- data/lib/countries/version.rb +1 -1
- data/spec/country_spec.rb +118 -22
- data/spec/data_spec.rb +12 -8
- data/spec/spec_helper.rb +4 -0
- data/spec/subdivision_spec.rb +8 -0
- metadata +23 -16
- data/.rubocop_todo.yml +0 -19
- data/lib/countries/tasks/geocoding.rake +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 558e68f4f533ad329ed3b08cfb026aef3d765e24bc997ec083b7cd37bb42c006
|
4
|
+
data.tar.gz: 112422bf94a5c6a3d1a3eaf94e6e0f533636568302621f6537fce95d5a779aa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5d0866ebe1b9eeff6b1c363bb89dac7a652eebe88d582743d21b50ee6f91de4f6364b938fe2f8c04e700331e9d2bdefca0b726e1c9f4810bf141c0d38a0645
|
7
|
+
data.tar.gz: bb2e954f511906dbe97e122aa23613e30fe6e12c0d9bc36a7649dd63f035dd51bd17a97bf1329a5b1f8e6f44cca8ca9bc31b0e70f08cc47ac5752cf31238b4e2
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
version: "2"
|
2
|
+
checks:
|
3
|
+
argument-count:
|
4
|
+
enabled: true
|
5
|
+
config:
|
6
|
+
threshold: 4
|
7
|
+
complex-logic:
|
8
|
+
enabled: true
|
9
|
+
config:
|
10
|
+
threshold: 4
|
11
|
+
file-lines:
|
12
|
+
enabled: true
|
13
|
+
config:
|
14
|
+
threshold: 250
|
15
|
+
method-complexity:
|
16
|
+
enabled: true
|
17
|
+
config:
|
18
|
+
threshold: 5
|
19
|
+
method-count:
|
20
|
+
enabled: true
|
21
|
+
config:
|
22
|
+
threshold: 20
|
23
|
+
method-lines:
|
24
|
+
enabled: true
|
25
|
+
config:
|
26
|
+
threshold: 25
|
27
|
+
nested-control-flow:
|
28
|
+
enabled: true
|
29
|
+
config:
|
30
|
+
threshold: 4
|
31
|
+
return-statements:
|
32
|
+
enabled: true
|
33
|
+
config:
|
34
|
+
threshold: 4
|
35
|
+
plugins:
|
36
|
+
rubocop:
|
37
|
+
enabled: true
|
38
|
+
channel: rubocop-1-48-1
|
39
|
+
reek:
|
40
|
+
enabled: true
|
41
|
+
checks:
|
42
|
+
IrresponsibleModule:
|
43
|
+
enabled: false
|
44
|
+
TooManyStatements:
|
45
|
+
max_statements: 7
|
46
|
+
flog:
|
47
|
+
enabled: true
|
48
|
+
bundler-audit:
|
49
|
+
enabled: true
|
50
|
+
exclude_patterns:
|
51
|
+
- "config/"
|
52
|
+
- "db/"
|
53
|
+
- "dist/"
|
54
|
+
- "features/"
|
55
|
+
- "**/node_modules/"
|
56
|
+
- "script/"
|
57
|
+
- "**/spec/"
|
58
|
+
- "**/test/"
|
59
|
+
- "**/tests/"
|
60
|
+
- "**/vendor/"
|
61
|
+
- "**/*.d.ts"
|
data/.github/workflows/tests.yml
CHANGED
@@ -17,6 +17,8 @@ jobs:
|
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
19
|
ruby: [2.7, '3.0', 3.1, 3.2]
|
20
|
+
env:
|
21
|
+
CC_TEST_REPORTER_ID: 1670b97bb8c09d4f4bad81e559f41c7588641c67bd700c933c267bbe7dbbef7f
|
20
22
|
steps:
|
21
23
|
- uses: actions/checkout@v3
|
22
24
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
@@ -26,3 +28,5 @@ jobs:
|
|
26
28
|
bundler-cache: true
|
27
29
|
- name: Run tests
|
28
30
|
run: bundle exec rake
|
31
|
+
- name: Publish code coverage
|
32
|
+
uses: paambaati/codeclimate-action@v4.0.0
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
1
|
|
3
2
|
AllCops:
|
4
3
|
NewCops: enable
|
4
|
+
TargetRubyVersion: 2.7
|
5
5
|
|
6
6
|
Layout/LineLength:
|
7
|
+
Max: 120
|
8
|
+
AllowedPatterns: ['^ *# ']
|
7
9
|
Exclude:
|
8
10
|
- countries.gemspec
|
11
|
+
- 'spec/**/*'
|
12
|
+
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Style/Documentation:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Bundler/OrderedGems:
|
20
|
+
Enabled: false
|
9
21
|
|
10
22
|
Metrics/BlockLength:
|
11
23
|
Exclude:
|
12
24
|
- 'spec/**/*'
|
13
25
|
- Rakefile
|
14
|
-
- 'spec/**/*'
|
15
26
|
- 'lib/countries/tasks/*'
|
16
27
|
|
17
|
-
Style/RescueModifier:
|
18
|
-
Enabled: false
|
19
|
-
|
20
28
|
Style/CaseEquality:
|
21
29
|
Exclude:
|
22
30
|
- 'lib/countries/country/finder_methods.rb'
|
@@ -33,8 +41,9 @@ Lint/AmbiguousBlockAssociation:
|
|
33
41
|
Exclude:
|
34
42
|
- 'spec/perf_spec.rb'
|
35
43
|
|
36
|
-
Metrics/MethodLength:
|
37
|
-
Max: 20
|
38
|
-
|
39
44
|
Metrics/ClassLength:
|
40
45
|
Max: 130
|
46
|
+
|
47
|
+
Metrics/AbcSize:
|
48
|
+
Exclude:
|
49
|
+
- 'lib/countries/sources/cldr/*'
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](https://semver.org/).
|
5
5
|
|
6
|
+
## [5.5.0](https://github.com/countries/countries/releases/tag/v5.5.0') (2023/06/17 16:20 +00:00)
|
7
|
+
|
8
|
+
* Added G20 and G7 member fields [\#799](https://github.com/countries/countries/pull/799) ([AndromedaSugar](https://github.com/AndromedaSugar))
|
9
|
+
* Update subdivision translations from CLDR [\#802](https://github.com/countries/countries/pull/802) ([pmor](https://github.com/pmor))
|
10
|
+
* Adds Country#collect_countries_with, Country#collect_likely_subdivisions, Country.find_subdivision_with, Country.find_subdivision_code_with_translations [\#800](https://github.com/countries/countries/pull/800) ([pmor](https://github.com/pmor))
|
11
|
+
* Add Japanese translation to subdivisions data [\#804](https://github.com/countries/countries/pull/804) ([shucream-p](https://github.com/shucream-p))
|
12
|
+
* Adding gdpr_compliant method to check if a country is regulated by GDPR [\#807](https://github.com/countries/countries/pull/807) ([yeseniamolinab](https://github.com/yeseniamolinab))
|
13
|
+
|
6
14
|
## [5.4.0](https://github.com/countries/countries/releases/tag/v5.4.0') (2023/04/12 12:44 +00:00)
|
7
15
|
|
8
16
|
* fix: RUP are part of the European Union [\#794](https://github.com/countries/countries/pull/794) ([btrd](https://github.com/btrd))
|
data/Gemfile
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
|
-
gem 'geocoder'
|
5
4
|
gem 'money'
|
6
5
|
gem 'rake'
|
7
6
|
gem 'retryable'
|
@@ -11,6 +10,6 @@ gem 'tzinfo'
|
|
11
10
|
gemspec
|
12
11
|
|
13
12
|
group :development, :test do
|
14
|
-
gem '
|
13
|
+
gem 'debug'
|
15
14
|
gem 'yaml'
|
16
15
|
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
countries (5.5.0)
|
5
|
+
unaccent (~> 0.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.0.5)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
15
|
+
concurrent-ruby (1.2.2)
|
16
|
+
debug (1.8.0)
|
17
|
+
irb (>= 1.5.0)
|
18
|
+
reline (>= 0.3.1)
|
19
|
+
diff-lcs (1.5.0)
|
20
|
+
docile (1.4.0)
|
21
|
+
i18n (1.14.1)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
io-console (0.6.0)
|
24
|
+
irb (1.7.0)
|
25
|
+
reline (>= 0.3.0)
|
26
|
+
minitest (5.18.1)
|
27
|
+
money (6.16.0)
|
28
|
+
i18n (>= 0.6.4, <= 2)
|
29
|
+
nokogiri (1.15.2-arm64-darwin)
|
30
|
+
racc (~> 1.4)
|
31
|
+
nokogiri (1.15.2-x86_64-darwin)
|
32
|
+
racc (~> 1.4)
|
33
|
+
nokogiri (1.15.2-x86_64-linux)
|
34
|
+
racc (~> 1.4)
|
35
|
+
racc (1.7.1)
|
36
|
+
rake (13.0.6)
|
37
|
+
reline (0.3.5)
|
38
|
+
io-console (~> 0.5)
|
39
|
+
retryable (3.0.5)
|
40
|
+
rspec (3.12.0)
|
41
|
+
rspec-core (~> 3.12.0)
|
42
|
+
rspec-expectations (~> 3.12.0)
|
43
|
+
rspec-mocks (~> 3.12.0)
|
44
|
+
rspec-core (3.12.2)
|
45
|
+
rspec-support (~> 3.12.0)
|
46
|
+
rspec-expectations (3.12.3)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.12.0)
|
49
|
+
rspec-mocks (3.12.5)
|
50
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
+
rspec-support (~> 3.12.0)
|
52
|
+
rspec-support (3.12.0)
|
53
|
+
simplecov (0.22.0)
|
54
|
+
docile (~> 1.1)
|
55
|
+
simplecov-html (~> 0.11)
|
56
|
+
simplecov_json_formatter (~> 0.1)
|
57
|
+
simplecov-html (0.12.3)
|
58
|
+
simplecov_json_formatter (0.1.4)
|
59
|
+
tzinfo (2.0.6)
|
60
|
+
concurrent-ruby (~> 1.0)
|
61
|
+
unaccent (0.4.0)
|
62
|
+
yaml (0.2.1)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
arm64-darwin-22
|
66
|
+
x86_64-darwin-21
|
67
|
+
x86_64-darwin-22
|
68
|
+
x86_64-linux
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
activesupport (>= 3)
|
72
|
+
countries!
|
73
|
+
debug
|
74
|
+
money
|
75
|
+
nokogiri (>= 1.8)
|
76
|
+
rake
|
77
|
+
retryable
|
78
|
+
rspec (>= 3)
|
79
|
+
simplecov (~> 0.22)
|
80
|
+
tzinfo
|
81
|
+
yaml
|
82
|
+
|
83
|
+
BUNDLED WITH
|
84
|
+
2.4.12
|
data/README.md
CHANGED
@@ -132,6 +132,18 @@ c.states # => {"CO" => {"name" => "Colorado", "names" => "Colorado"}, ... }
|
|
132
132
|
|
133
133
|
# Get specific translations for the country subdivisions
|
134
134
|
c.subdivision_names_with_codes('es') #=> [ ..., ["Nuevo Hampshire", "NH"], ["Nueva Jersey", "NJ"], ... ]
|
135
|
+
|
136
|
+
# Subdivision code with translations for all loaded locales
|
137
|
+
c.subdivisions['NY'].code_with_translations #=> {"NY"=>{"en"=>"New York"}, ...}
|
138
|
+
```
|
139
|
+
|
140
|
+
`#find_subdivision_by_name` Find a country's state using its code or name in any translation
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
> ISO3166::Country.new("IT").find_subdivision_by_name("Toscana").geo
|
144
|
+
=> {"latitude"=>43.771389, "longitude"=>11.254167, ... }
|
145
|
+
> ISO3166::Country.new("IT").find_subdivision_by_name("Tuscany").geo
|
146
|
+
=> {"latitude"=>43.771389, "longitude"=>11.254167, ... }
|
135
147
|
```
|
136
148
|
|
137
149
|
### Location
|
@@ -206,7 +218,13 @@ c.in_esm? # => false
|
|
206
218
|
c.in_eu_vat? # => false
|
207
219
|
```
|
208
220
|
|
209
|
-
|
221
|
+
### GDPR Compliant (European Economic Area Membership or UK)
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
c.gdpr_compliant? # => false
|
225
|
+
```
|
226
|
+
|
227
|
+
### Country Code in Emoji
|
210
228
|
|
211
229
|
```ruby
|
212
230
|
c = Country['MY']
|
@@ -219,6 +237,28 @@ c.emoji_flag # => "🇲🇾"
|
|
219
237
|
ISO3166::Country.pluck(:alpha2, :iso_short_name) # => [["AD", "Andorra"], ["AE", "United Arab Emirates"], ...
|
220
238
|
```
|
221
239
|
|
240
|
+
`.collect_countries_with` allows to collect various countries' informations using any valid method and query value:
|
241
|
+
```ruby
|
242
|
+
> ISO3166::Country.collect_countries_with("VR",:subdivisions,:common_name)
|
243
|
+
=> ["Italy", "Monaco"]
|
244
|
+
> ISO3166::Country.collect_countries_with("Caribbean",:subregion,:languages_spoken).flatten.uniq
|
245
|
+
=> ["en", "fr", "es", "ht", "nl"]
|
246
|
+
> ISO3166::Country.collect_countries_with("Oceania",:region,:international_prefix).uniq
|
247
|
+
=> ["00", "011", "0011", "19", "05"]
|
248
|
+
> ISO3166::Country.collect_countries_with("Antarctica",:continent,:emoji_flag)
|
249
|
+
=> ["🇦🇶", "🇬🇸", "🇧🇻", "🇹🇫", "🇭🇲"]
|
250
|
+
> ISO3166::Country.collect_countries_with("🇸🇨",:emoji_flag,:common_name)
|
251
|
+
=> ["Seychelles"]
|
252
|
+
```
|
253
|
+
|
254
|
+
`.collect_likely_countries_by_subdivision_name` allows to lookup all countries having the given state code or state name (in any translation)
|
255
|
+
|
256
|
+
```ruby
|
257
|
+
ISO3166::Country.collect_likely_countries_by_subdivision_name("San José",:common_name)
|
258
|
+
=> ["Costa Rica", "Uruguay"]
|
259
|
+
```
|
260
|
+
|
261
|
+
|
222
262
|
## Currencies
|
223
263
|
|
224
264
|
To enable currencies extension please add the following to countries initializer.
|
data/Rakefile
CHANGED
@@ -6,12 +6,10 @@ require 'bundler/gem_tasks'
|
|
6
6
|
require 'rake'
|
7
7
|
require 'rspec/core/rake_task'
|
8
8
|
require 'yaml'
|
9
|
+
require 'json'
|
9
10
|
|
10
11
|
ISO3166_ROOT_PATH = File.dirname(__FILE__)
|
11
12
|
|
12
|
-
# Enter your API Key enabled for Geocoding API and Places API
|
13
|
-
GOOGLE_API_KEY = 'ENTER API KEY'
|
14
|
-
|
15
13
|
Dir.glob('lib/countries/tasks/*.rake').each { |r| load r }
|
16
14
|
|
17
15
|
desc 'Run all examples'
|
@@ -56,6 +54,7 @@ task :cleanup_subdivision_yaml do
|
|
56
54
|
sd = Sources::Local::Subdivision.new(c_code)
|
57
55
|
data = sd.load
|
58
56
|
next if data.nil? || data == {}
|
57
|
+
|
59
58
|
data = data.sort.to_h
|
60
59
|
data['translations'] = data['translations'].sort.to_h unless data['translations'].nil?
|
61
60
|
sd.save(data)
|
data/countries.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |gem|
|
|
19
19
|
'rubygems_mfa_required' => 'true' }
|
20
20
|
|
21
21
|
gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
22
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
23
22
|
gem.require_paths = ['lib']
|
24
23
|
|
25
24
|
gem.required_ruby_version = '>= 2.7'
|
@@ -28,4 +27,5 @@ Gem::Specification.new do |gem|
|
|
28
27
|
gem.add_development_dependency('activesupport', '>= 3')
|
29
28
|
gem.add_development_dependency('nokogiri', '>= 1.8')
|
30
29
|
gem.add_development_dependency('rspec', '>= 3')
|
30
|
+
gem.add_development_dependency('simplecov', '~> 0.22')
|
31
31
|
end
|