ziptz 2.0.14 → 2.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +14 -12
- data/lib/ziptz.rb +3 -3
- data/spec/ziptz_spec.rb +13 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59c406bb22e85a240fda9583db9309ebeb8d7daea66cb0dda070ea1abe609fe3
|
4
|
+
data.tar.gz: b8e3530b393ab2221cf05d8120ae19b5d11385f9eb9f669f0bcd8d25c1691b58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce41f388e588d1a8e593e9b85b4f12083d7f6e3dfb9c564e11b2c8070d1ae39e6abdc5b0ae7b7b89b3149f872813d2a85ec4ac802ddfa0f65082f96b2fc28fc3
|
7
|
+
data.tar.gz: f93e68aa4e7c98be6587138efc619ed7601c960646c325d1539e7e7a74e5fac424a81891956401f7d654d48f459bdf67c4f6d21f3be3d842eee0232042abbc0b
|
data/Gemfile.lock
CHANGED
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
coderay (1.1.2)
|
24
24
|
concurrent-ruby (1.1.5)
|
25
25
|
diff-lcs (1.3)
|
26
|
-
ffi (1.
|
26
|
+
ffi (1.10.0)
|
27
27
|
formatador (0.2.5)
|
28
28
|
guard (2.15.0)
|
29
29
|
formatador (>= 0.2.4)
|
@@ -56,11 +56,12 @@ GEM
|
|
56
56
|
nenv (~> 0.1)
|
57
57
|
shellany (~> 0.0)
|
58
58
|
parallel (1.17.0)
|
59
|
-
parser (2.6.
|
59
|
+
parser (2.6.2.1)
|
60
60
|
ast (~> 2.4.0)
|
61
61
|
pry (0.12.2)
|
62
62
|
coderay (~> 1.1.0)
|
63
63
|
method_source (~> 0.9.0)
|
64
|
+
psych (3.1.0)
|
64
65
|
rainbow (3.0.0)
|
65
66
|
rake (12.3.2)
|
66
67
|
rb-fsevent (0.10.3)
|
@@ -72,25 +73,26 @@ GEM
|
|
72
73
|
rspec-mocks (~> 3.8.0)
|
73
74
|
rspec-core (3.8.0)
|
74
75
|
rspec-support (~> 3.8.0)
|
75
|
-
rspec-expectations (3.8.
|
76
|
+
rspec-expectations (3.8.2)
|
76
77
|
diff-lcs (>= 1.2.0, < 2.0)
|
77
78
|
rspec-support (~> 3.8.0)
|
78
79
|
rspec-mocks (3.8.0)
|
79
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
80
81
|
rspec-support (~> 3.8.0)
|
81
82
|
rspec-support (3.8.0)
|
82
|
-
rubocop (0.
|
83
|
+
rubocop (0.67.2)
|
83
84
|
jaro_winkler (~> 1.5.1)
|
84
85
|
parallel (~> 1.10)
|
85
|
-
parser (>= 2.
|
86
|
+
parser (>= 2.5, != 2.5.1.1)
|
87
|
+
psych (>= 3.1.0)
|
86
88
|
rainbow (>= 2.2.2, < 4.0)
|
87
89
|
ruby-progressbar (~> 1.7)
|
88
|
-
unicode-display_width (>= 1.4.0, < 1.
|
89
|
-
rubocop-performance (1.
|
90
|
-
rubocop (>= 0.
|
91
|
-
rubocop-rspec (1.
|
90
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
91
|
+
rubocop-performance (1.1.0)
|
92
|
+
rubocop (>= 0.67.0)
|
93
|
+
rubocop-rspec (1.32.0)
|
92
94
|
rubocop (>= 0.60.0)
|
93
|
-
ruby-progressbar (1.10.
|
95
|
+
ruby-progressbar (1.10.0)
|
94
96
|
ruby_dep (1.5.0)
|
95
97
|
shellany (0.0.1)
|
96
98
|
thor (0.20.3)
|
@@ -100,7 +102,7 @@ GEM
|
|
100
102
|
tty-cursor (~> 0.7)
|
101
103
|
tzinfo (1.2.5)
|
102
104
|
thread_safe (~> 0.1)
|
103
|
-
unicode-display_width (1.
|
105
|
+
unicode-display_width (1.5.0)
|
104
106
|
|
105
107
|
PLATFORMS
|
106
108
|
ruby
|
@@ -122,4 +124,4 @@ DEPENDENCIES
|
|
122
124
|
ziptz!
|
123
125
|
|
124
126
|
BUNDLED WITH
|
125
|
-
1.17.
|
127
|
+
1.17.3
|
data/lib/ziptz.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
class Ziptz
|
4
|
-
VERSION = '2.0.
|
4
|
+
VERSION = '2.0.15'.freeze
|
5
5
|
|
6
6
|
TZ_INFO = {
|
7
7
|
'0' => {name: 'APO/FPO (time zone unknown)', offset: 0},
|
@@ -30,7 +30,7 @@ class Ziptz
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def time_zone_uses_dst?(zip)
|
33
|
-
dst[zip.to_s]
|
33
|
+
dst[zip.to_s.slice(0, 5)]
|
34
34
|
end
|
35
35
|
|
36
36
|
def zips(tz_name)
|
@@ -61,7 +61,7 @@ class Ziptz
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def get_time_zone(zip)
|
64
|
-
tz[zip.to_s]
|
64
|
+
tz[zip.to_s.slice(0, 5)]
|
65
65
|
end
|
66
66
|
|
67
67
|
def tz_name_to_code
|
data/spec/ziptz_spec.rb
CHANGED
@@ -16,6 +16,12 @@ RSpec.describe Ziptz do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
context 'when given a 9-digit zipcode' do
|
20
|
+
it 'returns the time zone number' do
|
21
|
+
expect(ziptz.time_zone_name('97034-1234')).to eq 'America/Los_Angeles'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
19
25
|
context 'when there is no matching zipcode' do
|
20
26
|
it 'returns nil' do
|
21
27
|
expect(ziptz.time_zone_name('xyz')).to be_nil
|
@@ -39,6 +45,13 @@ RSpec.describe Ziptz do
|
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
48
|
+
context 'when given a 9-digit zipcode' do
|
49
|
+
it 'returns a boolean' do
|
50
|
+
expect(ziptz.time_zone_uses_dst?('97034-1234')).to eq true
|
51
|
+
expect(ziptz.time_zone_uses_dst?('85004-1234')).to eq false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
42
55
|
context 'when there is no matching zipcode' do
|
43
56
|
it 'returns nil' do
|
44
57
|
expect(ziptz.time_zone_offset('xyz')).to be_nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ziptz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Get timezone info for all 5-digit US zip codes
|
14
14
|
email: keithm@infused.org
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
|
-
rubygems_version: 3.0.
|
54
|
+
rubygems_version: 3.0.4
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: TimeZone info for any 5-digit US zip code
|