ziptz 1.1.37 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +32 -14
- data/lib/ziptz.rb +13 -13
- data/spec/ziptz_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c36416c578b6e6fe58181907429f71d2e12d0c74c1331aa025a9b3b59d8135b
|
4
|
+
data.tar.gz: 2942ed2c23881d8f9032dffd74053a9a6291e467e013ab8bc1172906d39ee861
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4617b3380eee2117b071f1e2c00dd65e2005e72cde770e187c9de5383f16a4e47ebefe9bb4b99148a379af133b38c900f7b7f6a09287be491ec5b56f087cd8bd
|
7
|
+
data.tar.gz: 69dab2c9bcec57d48d0bf77b711e11b174eda4ec1c7c239c1008bdb403da2f09442f5130c8bfa3da2224da717a23460ef5fc000c52063bac0e9be6d5fd8abc02
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Add the gem to your Gemfile:
|
|
20
20
|
Get the time zone name for any ZIP code:
|
21
21
|
|
22
22
|
z = Ziptz.new
|
23
|
-
z.time_zone_name('97213') #=> "
|
23
|
+
z.time_zone_name('97213') #=> "America/Los_Angeles"
|
24
24
|
|
25
25
|
Get the time zone offset for any ZIP code:
|
26
26
|
|
@@ -34,26 +34,44 @@ Determine if the ZIP code uses Daylight Saving Time:
|
|
34
34
|
|
35
35
|
Get all the zip codes in a time zone:
|
36
36
|
|
37
|
-
z.zips('
|
37
|
+
z.zips('Pacific/Pago_Pago') #=> ["96799", "96941", "96942", "96943", "96944"]
|
38
38
|
|
39
39
|
|
40
40
|
## Supported Time Zones
|
41
41
|
|
42
|
-
* "
|
43
|
-
* "
|
44
|
-
* "
|
45
|
-
* "
|
46
|
-
* "
|
47
|
-
* "
|
48
|
-
* "
|
49
|
-
* "
|
50
|
-
* "
|
51
|
-
* "Guam" UTC +10:00
|
52
|
-
* "Palau" UTC +09:00
|
53
|
-
* "
|
42
|
+
* "America/Puerto_Rico" UTC -04:00
|
43
|
+
* "America/New_York" UTC -05:00
|
44
|
+
* "America/Chicago" UTC -06:00
|
45
|
+
* "America/Denver" UTC -07:00
|
46
|
+
* "America/Los_Angeles" UTC -08:00
|
47
|
+
* "America/Anchorage" UTC -09:00
|
48
|
+
* "Pacific/Honolulu" UTC -10:00
|
49
|
+
* "Pacific/Pago_Pago" UTC -11:00
|
50
|
+
* "Pacific/Majuro" UTC +12:00
|
51
|
+
* "Pacific/Guam" UTC +10:00
|
52
|
+
* "Pacific/Palau" UTC +09:00
|
53
|
+
* "Pacific/Pohnpei" UTC +11:00
|
54
54
|
|
55
55
|
<em>Note that APO/FPO zip codes will not return a known time zone offset.</em>
|
56
56
|
|
57
|
+
## Version 2 breaking changes
|
58
|
+
|
59
|
+
Time zone names now reflect standard tz-database names.
|
60
|
+
|
61
|
+
| V1 Name | V2 Name |
|
62
|
+
| --- | --- |
|
63
|
+
| Atlantic | America/Puerto_Rico |
|
64
|
+
| Eastern | America/New_York |
|
65
|
+
| Central | America/Chicago |
|
66
|
+
| Mountain | America/Denver |
|
67
|
+
| Pacific | America/Los_Angeles |
|
68
|
+
| Hawaii-Aleutian Islands | Pacific/Honolulu |
|
69
|
+
| American Samoa | Pacific/Pago_Pago |
|
70
|
+
| Marshall Islands | Pacific/Majuro |
|
71
|
+
| Guam | Pacific/Guam |
|
72
|
+
| Palau | Pacific/Palau |
|
73
|
+
| Micronesia | Pacific/Pohnpei |
|
74
|
+
|
57
75
|
## License
|
58
76
|
|
59
77
|
Copyright (c) 2015-2018 Keith Morrison <<keithm@infused.org>>
|
data/lib/ziptz.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
|
3
3
|
class Ziptz
|
4
|
-
VERSION = '
|
4
|
+
VERSION = '2.0.0'
|
5
5
|
|
6
6
|
TZ_INFO = {
|
7
7
|
'0' => {name: 'APO/FPO (time zone unknown)', offset: 0},
|
8
|
-
'4' => {name: '
|
9
|
-
'5' => {name: '
|
10
|
-
'6' => {name: '
|
11
|
-
'7' => {name: '
|
12
|
-
'8' => {name: '
|
13
|
-
'9' => {name: '
|
14
|
-
'10' => {name: '
|
15
|
-
'11' => {name: '
|
16
|
-
'13' => {name: '
|
17
|
-
'14' => {name: 'Guam', offset: 10},
|
18
|
-
'15' => {name: 'Palau', offset: 9},
|
19
|
-
'16' => {name: '
|
8
|
+
'4' => {name: 'America/Puerto_Rico', offset: -4},
|
9
|
+
'5' => {name: 'America/New_York', offset: -5},
|
10
|
+
'6' => {name: 'America/Chicago', offset: -6},
|
11
|
+
'7' => {name: 'America/Denver', offset: -7},
|
12
|
+
'8' => {name: 'America/Los_Angeles', offset: -8},
|
13
|
+
'9' => {name: 'America/Anchorage', offset: -9},
|
14
|
+
'10' => {name: 'America/Adak', offset: -10},
|
15
|
+
'11' => {name: 'Pacific/Pago_Pago', offset: -11},
|
16
|
+
'13' => {name: 'Pacific/Majuro', offset: 12},
|
17
|
+
'14' => {name: 'Pacific/Guam', offset: 10},
|
18
|
+
'15' => {name: 'Pacific/Palau', offset: 9},
|
19
|
+
'16' => {name: 'Pacific/Pohnpei', offset: 11}
|
20
20
|
}
|
21
21
|
|
22
22
|
def initialize
|
data/spec/ziptz_spec.rb
CHANGED
@@ -14,7 +14,7 @@ describe Ziptz do
|
|
14
14
|
|
15
15
|
context 'when given a 5-digit zipcode' do
|
16
16
|
it 'returns the time zone number' do
|
17
|
-
expect(ziptz.time_zone_name('97034')).to eq '
|
17
|
+
expect(ziptz.time_zone_name('97034')).to eq 'America/Los_Angeles'
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -30,7 +30,7 @@ describe Ziptz do
|
|
30
30
|
|
31
31
|
context 'when given a 5-digit zipcode' do
|
32
32
|
it 'returns the time zone number' do
|
33
|
-
expect(ziptz.time_zone_name('97034')).to eq '
|
33
|
+
expect(ziptz.time_zone_name('97034')).to eq 'America/Los_Angeles'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -57,11 +57,11 @@ describe Ziptz do
|
|
57
57
|
let(:ziptz) { Ziptz.new }
|
58
58
|
|
59
59
|
it 'returns an array of zip codes' do
|
60
|
-
expect(ziptz.zips('
|
60
|
+
expect(ziptz.zips('Pacific/Pago_Pago')).to eq %w(96799)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'is case-insensitive' do
|
64
|
-
expect(ziptz.zips('
|
64
|
+
expect(ziptz.zips('Pacific/Pago_Pago')).to eq %w(96799)
|
65
65
|
end
|
66
66
|
|
67
67
|
it 'returns nil for unknown time zones' do
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Morrison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-25 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
|