zip_to_timezone 0.1.0 → 0.2.0
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 +7 -0
- data/.travis.yml +7 -0
- data/Gemfile.lock +25 -19
- data/README.rdoc +22 -10
- data/lib/zip_to_timezone/version.rb +1 -1
- data/spec/zip_to_timezone_spec.rb +7 -7
- data/zip_to_timezone.gemspec +4 -4
- metadata +73 -98
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 660e30ac1727b165bfe3e9b2a7d642b68ed5277148d97da0be56004b795d6b0d
|
4
|
+
data.tar.gz: f7708073eebf094aac7d156702b9fed6374e4b6ad4be7533d277f880b757eafc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b78bca0f80461d011a2088de61701de71c2c8ac8d1ba2d310b20031dde8298de41e0ed16cddcddfbb92f7fb78b707dfcf145b6d39a9b7d316c178c5cd7a7d03
|
7
|
+
data.tar.gz: 9c5731f66af1d1a11cb9438aec1f431a7a16fef9d1256089ab08c9cb60d2f8dc3a5483694839304c79a5dc56c8a0ddd6c3b6fb414ae88d84ad417b794cb394d7
|
data/.travis.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,32 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
zip_to_timezone (0.
|
5
|
-
algorithms (
|
4
|
+
zip_to_timezone (0.2.0)
|
5
|
+
algorithms (~> 0.6.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
algorithms (0.
|
11
|
-
diff-lcs (1.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
rspec-
|
18
|
-
|
19
|
-
rspec-
|
20
|
-
rspec-
|
21
|
-
|
22
|
-
|
23
|
-
rspec-mocks (
|
10
|
+
algorithms (0.6.1)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
rake (12.3.2)
|
13
|
+
rdoc (6.0.4)
|
14
|
+
rspec (3.8.0)
|
15
|
+
rspec-core (~> 3.8.0)
|
16
|
+
rspec-expectations (~> 3.8.0)
|
17
|
+
rspec-mocks (~> 3.8.0)
|
18
|
+
rspec-core (3.8.0)
|
19
|
+
rspec-support (~> 3.8.0)
|
20
|
+
rspec-expectations (3.8.2)
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-mocks (3.8.0)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.8.0)
|
26
|
+
rspec-support (3.8.0)
|
24
27
|
|
25
28
|
PLATFORMS
|
26
29
|
ruby
|
27
30
|
|
28
31
|
DEPENDENCIES
|
29
|
-
rake (
|
30
|
-
rdoc (
|
31
|
-
rspec (
|
32
|
+
rake (~> 12.3.2)
|
33
|
+
rdoc (~> 6.0.4)
|
34
|
+
rspec (~> 3.8.0)
|
32
35
|
zip_to_timezone!
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
1.17.2
|
data/README.rdoc
CHANGED
@@ -1,15 +1,19 @@
|
|
1
1
|
= zip_to_timezone
|
2
2
|
|
3
|
-
|
3
|
+
{<img src="https://travis-ci.com/rgarver/zip_to_timezone.svg?branch=master" alt="Build Status" />}[https://travis-ci.com/rgarver/zip_to_timezone]
|
4
|
+
|
5
|
+
This gem is designed to map US postal codes to the timezone. The timezone
|
6
|
+
strings are based on ActiveSupport::TimeZone settings that include basic DST
|
7
|
+
information. If used with Rails these timezones will handle DST changes on
|
8
|
+
their own.
|
4
9
|
|
5
10
|
== Installation
|
6
11
|
|
7
12
|
gem install zip_to_timezone
|
8
13
|
|
9
|
-
|
14
|
+
If you are using bundler you can add a line to your <tt>Gemfile</tt>:
|
10
15
|
|
11
|
-
gem
|
12
|
-
gem tumble
|
16
|
+
gem "zip_to_timezone"
|
13
17
|
|
14
18
|
== Usage
|
15
19
|
|
@@ -19,11 +23,19 @@ This is super simple to use:
|
|
19
23
|
|
20
24
|
== How it works
|
21
25
|
|
22
|
-
This uses Trei longest prefix matching to speed up the searching. This means
|
26
|
+
This uses Trei longest prefix matching to speed up the searching. This means
|
27
|
+
that all zip codes that start with 90 will be in California and therefore are in
|
28
|
+
Pacific Time. If I need to match on full zip codes in some states to
|
29
|
+
differentiate timezones I can do that (eg: Kansas or Indiana) by just adding
|
30
|
+
more specific entires.
|
23
31
|
|
24
32
|
== Note on accuracy
|
25
33
|
|
26
|
-
This gem combines two things that kind of suck to make them suck less. To do
|
34
|
+
This gem combines two things that kind of suck to make them suck less. To do
|
35
|
+
this though I had to make a lot of guesses. Please let me know if there are bad
|
36
|
+
mappings so I can fix them. My data is imperfect and in some places outright
|
37
|
+
wrong. The goal of the project was to handle the 95% case and hopefully grow it
|
38
|
+
to be more accurate over time.
|
27
39
|
|
28
40
|
== References
|
29
41
|
|
@@ -32,12 +44,12 @@ This gem combines two things that kind of suck to make them suck less. To do th
|
|
32
44
|
|
33
45
|
== Note on Patches/Pull Requests
|
34
46
|
|
35
|
-
* Fork the project.
|
36
|
-
*
|
37
|
-
* Add tests for it. This is important so I don't break it in a
|
47
|
+
* Fork the project. Make your feature addition or bug fix. Add tests for it.
|
48
|
+
* This is important so I don't break it in a
|
38
49
|
future version unintentionally.
|
39
50
|
* Commit, do not mess with rakefile, version, or history.
|
40
|
-
(if you want to have your own version, that is fine but bump version in a
|
51
|
+
(if you want to have your own version, that is fine but bump version in a
|
52
|
+
commit by itself I can ignore when I pull)
|
41
53
|
* Send me a pull request. Bonus points for topic branches.
|
42
54
|
|
43
55
|
== Copyright
|
@@ -1,21 +1,21 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
2
|
|
3
|
-
describe "ZipToTimezone" do
|
3
|
+
describe "expect(ZipToTimezone" do
|
4
4
|
it "should show that San Diego is Pacific Time" do
|
5
|
-
ZipToTimezone.get_timezone_for('92129').
|
5
|
+
expect(ZipToTimezone.get_timezone_for('92129')).to eql('Pacific Time (US & Canada)')
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should show that DC is Eastern Time" do
|
9
|
-
ZipToTimezone.get_timezone_for('20001').
|
9
|
+
expect(ZipToTimezone.get_timezone_for('20001')).to eql('Eastern Time (US & Canada)')
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should know that some of MI is in Central time" do
|
13
|
-
ZipToTimezone.get_timezone_for('49915').
|
14
|
-
ZipToTimezone.get_timezone_for('49914').
|
13
|
+
expect(ZipToTimezone.get_timezone_for('49915')).to eql('Central Time (US & Canada)')
|
14
|
+
expect(ZipToTimezone.get_timezone_for('49914')).to eql('Eastern Time (US & Canada)')
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should know that Roswell NM is in Mountain time" do
|
18
|
-
ZipToTimezone.get_timezone_for('88201').
|
19
|
-
ZipToTimezone.get_timezone_for('88203').
|
18
|
+
expect(ZipToTimezone.get_timezone_for('88201')).to eql('Mountain Time (US & Canada)')
|
19
|
+
expect(ZipToTimezone.get_timezone_for('88203')).to eql('Mountain Time (US & Canada)')
|
20
20
|
end
|
21
21
|
end
|
data/zip_to_timezone.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_development_dependency(%q<rake>, ["
|
20
|
-
s.add_development_dependency(%q<rdoc>, ["
|
21
|
-
s.add_development_dependency(%q<rspec>, ["
|
22
|
-
s.add_runtime_dependency(%q<algorithms>, ["
|
19
|
+
s.add_development_dependency(%q<rake>, ["~> 12.3.2"])
|
20
|
+
s.add_development_dependency(%q<rdoc>, ["~> 6.0.4"])
|
21
|
+
s.add_development_dependency(%q<rspec>, ["~> 3.8.0"])
|
22
|
+
s.add_runtime_dependency(%q<algorithms>, ["~> 0.6.1"])
|
23
23
|
end
|
24
24
|
|
metadata
CHANGED
@@ -1,96 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip_to_timezone
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Ryan Garver
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
-
none: false
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
hash: 63
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
- 9
|
30
|
-
- 2
|
31
|
-
version: 0.9.2
|
32
|
-
prerelease: false
|
33
|
-
type: :development
|
34
|
-
requirement: *id001
|
11
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
35
14
|
name: rake
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 11
|
43
|
-
segments:
|
44
|
-
- 2
|
45
|
-
- 4
|
46
|
-
version: "2.4"
|
47
|
-
prerelease: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 12.3.2
|
48
20
|
type: :development
|
49
|
-
requirement: *id002
|
50
|
-
name: rdoc
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 19
|
58
|
-
segments:
|
59
|
-
- 2
|
60
|
-
- 7
|
61
|
-
- 0
|
62
|
-
version: 2.7.0
|
63
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 12.3.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.0.4
|
64
34
|
type: :development
|
65
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.0.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
66
42
|
name: rspec
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
hash: 13
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
- 3
|
77
|
-
version: "0.3"
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.8.0
|
48
|
+
type: :development
|
78
49
|
prerelease: false
|
79
|
-
|
80
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.8.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
81
56
|
name: algorithms
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.1
|
82
69
|
description: Map US postal codes to US timezones. Compatible with Rails.
|
83
70
|
email: ragarver@gmail.com
|
84
71
|
executables: []
|
85
|
-
|
86
72
|
extensions: []
|
87
|
-
|
88
73
|
extra_rdoc_files: []
|
89
|
-
|
90
|
-
|
91
|
-
- .
|
92
|
-
- .
|
93
|
-
- .
|
74
|
+
files:
|
75
|
+
- ".document"
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
94
79
|
- Gemfile
|
95
80
|
- Gemfile.lock
|
96
81
|
- LICENSE
|
@@ -103,37 +88,27 @@ files:
|
|
103
88
|
- zip_to_timezone.gemspec
|
104
89
|
homepage: http://github.com/rgarver/zip_to_timezone
|
105
90
|
licenses: []
|
106
|
-
|
91
|
+
metadata: {}
|
107
92
|
post_install_message:
|
108
93
|
rdoc_options: []
|
109
|
-
|
110
|
-
require_paths:
|
94
|
+
require_paths:
|
111
95
|
- lib
|
112
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
-
|
114
|
-
requirements:
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
115
98
|
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
version: "0"
|
121
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
|
-
requirements:
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
124
103
|
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
version: "0"
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
130
106
|
requirements: []
|
131
|
-
|
132
107
|
rubyforge_project:
|
133
|
-
rubygems_version:
|
108
|
+
rubygems_version: 2.7.6
|
134
109
|
signing_key:
|
135
|
-
specification_version:
|
110
|
+
specification_version: 4
|
136
111
|
summary: Map US postal codes to US timezones
|
137
|
-
test_files:
|
112
|
+
test_files:
|
138
113
|
- spec/spec_helper.rb
|
139
114
|
- spec/zip_to_timezone_spec.rb
|