active_utils 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/active_utils/country.rb +10 -0
- data/lib/active_utils/version.rb +1 -1
- data/test/unit/country_test.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d8234345a5251007b9c809bbcc5e50b32ebebb
|
4
|
+
data.tar.gz: adcbab00d7199a94080f05752263ea58f20287c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d5a842367ece5521c59fd297282c210c7badcf47b5f555e0ed16f941389455beca70049d8351771780cdd42b7ba944b0e39e2fc9713d6163b53942d51327e5
|
7
|
+
data.tar.gz: a79a175dd538dd1618759154c397ff5d29a979bad770ef60a56a80ced02276c3e03e03590dfb43bca93526ec67142ffbe70dbaa3c8d23a4771c76adba2c51f86
|
data/CHANGELOG.md
CHANGED
data/lib/active_utils/country.rb
CHANGED
@@ -313,6 +313,16 @@ module ActiveUtils #:nodoc:
|
|
313
313
|
{ :alpha2 => 'AX', :name => 'Åland Islands', :alpha3 => 'ALA', :numeric => '248' }
|
314
314
|
]
|
315
315
|
|
316
|
+
COUNTRIES_THAT_DO_NOT_USE_POSTALCODES = %w(
|
317
|
+
QA BZ BS BF BJ AG AE AI AO AW HK
|
318
|
+
FJ ML JM ZW YE UG TV TT TG TD PA
|
319
|
+
CW
|
320
|
+
)
|
321
|
+
|
322
|
+
def uses_postal_codes?
|
323
|
+
!COUNTRIES_THAT_DO_NOT_USE_POSTALCODES.include?(code(:alpha2).value)
|
324
|
+
end
|
325
|
+
|
316
326
|
def self.find(name)
|
317
327
|
raise InvalidCountryCodeError, "Cannot lookup country for an empty name" if name.blank?
|
318
328
|
|
data/lib/active_utils/version.rb
CHANGED
data/test/unit/country_test.rb
CHANGED
@@ -65,4 +65,13 @@ class CountryTest < Minitest::Test
|
|
65
65
|
assert_equal(country_names.sort, country_names)
|
66
66
|
end
|
67
67
|
|
68
|
+
def test_canada_uses_postal_codes
|
69
|
+
canada = Country.find('Canada')
|
70
|
+
assert canada.uses_postal_codes?
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_qatar_does_not_use_postal_codes
|
74
|
+
qatar = Country.find('Qatar')
|
75
|
+
refute qatar.uses_postal_codes?
|
76
|
+
end
|
68
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|