countries 0.9.3 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +1 -0
- data/.travis.yml +1 -0
- data/README.markdown +2 -0
- data/Rakefile +16 -0
- data/countries.gemspec +1 -1
- data/lib/countries/country.rb +17 -2
- data/lib/countries/version.rb +1 -1
- data/lib/data/countries.yaml +1516 -20
- data/lib/data/subdivisions/AE.yaml +22 -9
- data/lib/data/subdivisions/AT.yaml +2 -1
- data/lib/data/subdivisions/CA.yaml +21 -10
- data/lib/data/subdivisions/CU.yaml +12 -4
- data/lib/data/subdivisions/ES.yaml +1 -0
- data/lib/data/subdivisions/HR.yaml +52 -32
- data/lib/data/subdivisions/JO.yaml +2 -2
- data/lib/data/subdivisions/JP.yaml +74 -40
- data/lib/data/subdivisions/NO.yaml +21 -40
- data/lib/data/subdivisions/RU.yaml +333 -283
- data/lib/data/subdivisions/SG.yaml +15 -3
- data/spec/country_spec.rb +75 -0
- metadata +17 -17
@@ -1,4 +1,16 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
name: "Singapore
|
4
|
-
names: "Singapore
|
2
|
+
SG-01:
|
3
|
+
name: "Central Singapore"
|
4
|
+
names: "Central Singapore"
|
5
|
+
SG-02:
|
6
|
+
name: "North East"
|
7
|
+
names: "North East"
|
8
|
+
SG-03:
|
9
|
+
name: "North West"
|
10
|
+
names: "North West"
|
11
|
+
SG-04:
|
12
|
+
name: "South East"
|
13
|
+
names: "South East"
|
14
|
+
SG-05:
|
15
|
+
name: "South West"
|
16
|
+
names: "South West"
|
data/spec/country_spec.rb
CHANGED
@@ -53,6 +53,15 @@ describe ISO3166::Country do
|
|
53
53
|
country.continent.should == "North America"
|
54
54
|
end
|
55
55
|
|
56
|
+
it 'knows about whether or not the country uses postal codes' do
|
57
|
+
country.zip.should be_true
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'knows when a country does not require postal codes' do
|
61
|
+
ireland = ISO3166::Country.search('IE')
|
62
|
+
ireland.postal_code.should == false
|
63
|
+
end
|
64
|
+
|
56
65
|
it 'should return region' do
|
57
66
|
country.region.should == 'Americas'
|
58
67
|
end
|
@@ -61,6 +70,26 @@ describe ISO3166::Country do
|
|
61
70
|
country.subregion.should == 'Northern America'
|
62
71
|
end
|
63
72
|
|
73
|
+
it 'should return world region' do
|
74
|
+
country.world_region.should == 'AMER'
|
75
|
+
end
|
76
|
+
|
77
|
+
context 'with Turkey' do
|
78
|
+
let(:country) { ISO3166::Country.search('TR') }
|
79
|
+
|
80
|
+
it 'should indicate EMEA as the world region' do
|
81
|
+
country.world_region.should == 'EMEA'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'with Japan' do
|
86
|
+
let(:country) { ISO3166::Country.search('JP') }
|
87
|
+
|
88
|
+
it 'should indicate APAC as the world region' do
|
89
|
+
country.world_region.should == 'APAC'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
64
93
|
it 'should return ioc code' do
|
65
94
|
country.ioc.should == 'USA'
|
66
95
|
end
|
@@ -158,6 +187,26 @@ describe ISO3166::Country do
|
|
158
187
|
end
|
159
188
|
end
|
160
189
|
|
190
|
+
describe 'all_translated' do
|
191
|
+
it 'should return an alphabetized list of all country names translated to the selected locale' do
|
192
|
+
countries = ISO3166::Country.all_translated('fr')
|
193
|
+
countries.should be_an(Array)
|
194
|
+
countries.first.should be_a(String)
|
195
|
+
countries.first.should eq('Afghanistan')
|
196
|
+
# countries missing the desired locale will not be added to the list
|
197
|
+
# so all 250 countries may not be returned, 'fr' returns 249, for example
|
198
|
+
countries.should have(249).countries
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'should return an alphabetized list of all country names in English if no locale is passed' do
|
202
|
+
countries = ISO3166::Country.all_translated
|
203
|
+
countries.should be_an(Array)
|
204
|
+
countries.first.should be_a(String)
|
205
|
+
countries.first.should eq('Afghanistan')
|
206
|
+
countries.should have(250).countries
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
161
210
|
describe 'countries' do
|
162
211
|
it 'should be the same as all' do
|
163
212
|
ISO3166::Country.countries.should == ISO3166::Country.all
|
@@ -378,6 +427,14 @@ describe ISO3166::Country do
|
|
378
427
|
end
|
379
428
|
end
|
380
429
|
|
430
|
+
describe 'Guernsey' do
|
431
|
+
let(:guernsey) { ISO3166::Country.search('GG') }
|
432
|
+
|
433
|
+
it 'should have a currency' do
|
434
|
+
guernsey.currency.code.should == 'GBP'
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
381
438
|
describe 'Languages' do
|
382
439
|
let(:german_speaking_countries) { ISO3166::Country.find_all_countries_by_languages('de') }
|
383
440
|
|
@@ -404,4 +461,22 @@ describe ISO3166::Country do
|
|
404
461
|
end
|
405
462
|
end
|
406
463
|
|
464
|
+
describe 'VAT rates' do
|
465
|
+
let(:belgium) { ISO3166::Country.search('BE') }
|
466
|
+
|
467
|
+
it 'should not return a vat_rate for countries without federal VAT' do
|
468
|
+
country.vat_rates.should == nil
|
469
|
+
end
|
470
|
+
|
471
|
+
it 'should contain all keys for vat_rates' do
|
472
|
+
belgium.vat_rates.should be_a(Hash)
|
473
|
+
belgium.vat_rates.keys.should == ["standard", "reduced", "super_reduced", "parking"]
|
474
|
+
end
|
475
|
+
|
476
|
+
it 'should return an array of reduced vat rates' do
|
477
|
+
belgium.vat_rates["reduced"].should be_an(Array)
|
478
|
+
belgium.vat_rates["reduced"].should == [6, 12]
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
407
482
|
end
|
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: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Robinson
|
@@ -9,48 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: currencies
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 0.4.2
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - ~>
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 0.4.2
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - "<"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '3'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - "<"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '3'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: yard
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- -
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
description: All sorts of useful information about every country packaged as pretty
|
@@ -61,11 +61,10 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
-
- .document
|
65
|
-
- .gitignore
|
66
|
-
- .travis.yml
|
64
|
+
- ".document"
|
65
|
+
- ".gitignore"
|
66
|
+
- ".travis.yml"
|
67
67
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
68
|
- LICENSE
|
70
69
|
- README.markdown
|
71
70
|
- Rakefile
|
@@ -285,17 +284,17 @@ require_paths:
|
|
285
284
|
- lib
|
286
285
|
required_ruby_version: !ruby/object:Gem::Requirement
|
287
286
|
requirements:
|
288
|
-
- -
|
287
|
+
- - ">="
|
289
288
|
- !ruby/object:Gem::Version
|
290
289
|
version: '0'
|
291
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
292
291
|
requirements:
|
293
|
-
- -
|
292
|
+
- - ">="
|
294
293
|
- !ruby/object:Gem::Version
|
295
294
|
version: '0'
|
296
295
|
requirements: []
|
297
296
|
rubyforge_project:
|
298
|
-
rubygems_version: 2.0.
|
297
|
+
rubygems_version: 2.0.0
|
299
298
|
signing_key:
|
300
299
|
specification_version: 4
|
301
300
|
summary: Gives you a country object full of all sorts of useful information.
|
@@ -303,3 +302,4 @@ test_files:
|
|
303
302
|
- spec/country_spec.rb
|
304
303
|
- spec/mongoid_spec.rb
|
305
304
|
- spec/spec_helper.rb
|
305
|
+
has_rdoc:
|