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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +14 -12
  3. data/lib/ziptz.rb +3 -3
  4. data/spec/ziptz_spec.rb +13 -0
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dfcb4643d68116de17556c618e01b6c9ea06b0bcf0858db0f5268741fca53bf
4
- data.tar.gz: c2b06ec80ab1a9e07810db034cb44848aabccc93db4f348debb47186d15309aa
3
+ metadata.gz: 59c406bb22e85a240fda9583db9309ebeb8d7daea66cb0dda070ea1abe609fe3
4
+ data.tar.gz: b8e3530b393ab2221cf05d8120ae19b5d11385f9eb9f669f0bcd8d25c1691b58
5
5
  SHA512:
6
- metadata.gz: c8944fccf83591bb210047fa630a948800cc8e0025f943c1354d1b6bd4f4a29ca7d614be611b3f75994bb1a9fd441d4fc6c32fd143ecda1f6fc197aaffff597e
7
- data.tar.gz: fcb8c7dffb167fa2480ea74a96e4a88e22cef7037e2dac2b06d72e91ac2201108a3d6d7c67d413e8ba20fe90b5f6002b1bc9bdc06b6cea9a645942cf8063f209
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.11.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.3.0)
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.3)
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.71.0)
83
+ rubocop (0.67.2)
83
84
  jaro_winkler (~> 1.5.1)
84
85
  parallel (~> 1.10)
85
- parser (>= 2.6)
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.7)
89
- rubocop-performance (1.3.0)
90
- rubocop (>= 0.68.0)
91
- rubocop-rspec (1.33.0)
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.1)
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.6.0)
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.2
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.14'.freeze
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.14
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-07-31 00:00:00.000000000 Z
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.3
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