zip_to_timezone 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/{spec/spec.opts → .rspec} +0 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +32 -0
- data/Rakefile +6 -30
- data/lib/zip_to_timezone/version.rb +3 -0
- data/lib/zip_to_timezone.rb +3 -1
- data/spec/spec_helper.rb +1 -7
- data/spec/zip_to_timezone_spec.rb +7 -2
- data/zip_to_timezone.gemspec +24 -0
- metadata +78 -24
- data/VERSION +0 -1
data/.gitignore
CHANGED
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
zip_to_timezone (0.1.0)
|
5
|
+
algorithms (>= 0.3)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
algorithms (0.3.0)
|
11
|
+
diff-lcs (1.1.3)
|
12
|
+
json (1.6.1)
|
13
|
+
rake (0.9.2)
|
14
|
+
rdoc (3.11)
|
15
|
+
json (~> 1.4)
|
16
|
+
rspec (2.7.0)
|
17
|
+
rspec-core (~> 2.7.0)
|
18
|
+
rspec-expectations (~> 2.7.0)
|
19
|
+
rspec-mocks (~> 2.7.0)
|
20
|
+
rspec-core (2.7.1)
|
21
|
+
rspec-expectations (2.7.0)
|
22
|
+
diff-lcs (~> 1.1.2)
|
23
|
+
rspec-mocks (2.7.0)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
rake (>= 0.9.2)
|
30
|
+
rdoc (>= 2.4)
|
31
|
+
rspec (>= 2.7.0)
|
32
|
+
zip_to_timezone!
|
data/Rakefile
CHANGED
@@ -1,41 +1,17 @@
|
|
1
|
-
require
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "zip_to_timezone"
|
8
|
-
gem.summary = %Q{Map US postal codes to US timezones}
|
9
|
-
gem.description = %Q{Map US postal codes to US timezones. Compatible with Rails.}
|
10
|
-
gem.email = "ragarver@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/rgarver/zip_to_timezone"
|
12
|
-
gem.authors = ["Ryan Garver"]
|
13
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
gem.add_dependency "algorithms", ">=0.3"
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'spec/rake/spectask'
|
23
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
-
spec.libs << 'lib' << 'spec'
|
25
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
4
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
26
5
|
end
|
27
6
|
|
28
|
-
|
29
|
-
spec.libs << 'lib' << 'spec'
|
7
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
30
8
|
spec.pattern = 'spec/**/*_spec.rb'
|
31
9
|
spec.rcov = true
|
32
10
|
end
|
33
11
|
|
34
|
-
task :spec => :check_dependencies
|
35
|
-
|
36
12
|
task :default => :spec
|
37
13
|
|
38
|
-
require '
|
14
|
+
require 'rdoc/task'
|
39
15
|
Rake::RDocTask.new do |rdoc|
|
40
16
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
17
|
|
data/lib/zip_to_timezone.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'algorithms'
|
2
|
+
require 'zip_to_timezone/version'
|
2
3
|
|
3
4
|
class ZipToTimezone
|
4
5
|
MAPPINGS = {
|
@@ -12,6 +13,7 @@ class ZipToTimezone
|
|
12
13
|
'832'..'837', # => ID
|
13
14
|
'840'..'847', # => UT
|
14
15
|
'870'..'875', # => NM
|
16
|
+
'882', # => Roswell, NM
|
15
17
|
'885', '799', # => El Paso, TX
|
16
18
|
'979', # => East OR
|
17
19
|
'865', # => North East AZ
|
@@ -87,4 +89,4 @@ class ZipToTimezone
|
|
87
89
|
end
|
88
90
|
return mapper
|
89
91
|
end
|
90
|
-
end
|
92
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require 'rubygems'
|
4
1
|
require 'zip_to_timezone'
|
5
|
-
require 'spec'
|
6
|
-
require 'spec/autorun'
|
7
|
-
|
8
|
-
Spec::Runner.configure do |config|
|
9
2
|
|
3
|
+
RSpec.configure do |config|
|
10
4
|
end
|
@@ -4,13 +4,18 @@ describe "ZipToTimezone" do
|
|
4
4
|
it "should show that San Diego is Pacific Time" do
|
5
5
|
ZipToTimezone.get_timezone_for('92129').should == 'Pacific Time (US & Canada)'
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
it "should show that DC is Eastern Time" do
|
9
9
|
ZipToTimezone.get_timezone_for('20001').should == 'Eastern Time (US & Canada)'
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
it "should know that some of MI is in Central time" do
|
13
13
|
ZipToTimezone.get_timezone_for('49915').should == 'Central Time (US & Canada)'
|
14
14
|
ZipToTimezone.get_timezone_for('49914').should == 'Eastern Time (US & Canada)'
|
15
15
|
end
|
16
|
+
|
17
|
+
it "should know that Roswell NM is in Mountain time" do
|
18
|
+
ZipToTimezone.get_timezone_for('88201').should == 'Mountain Time (US & Canada)'
|
19
|
+
ZipToTimezone.get_timezone_for('88203').should == 'Mountain Time (US & Canada)'
|
20
|
+
end
|
16
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'zip_to_timezone/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{zip_to_timezone}
|
7
|
+
s.version = ZipToTimezone::VERSION
|
8
|
+
s.authors = ["Ryan Garver"]
|
9
|
+
s.email = %q{ragarver@gmail.com}
|
10
|
+
s.homepage = %q{http://github.com/rgarver/zip_to_timezone}
|
11
|
+
s.summary = %q{Map US postal codes to US timezones}
|
12
|
+
s.description = %q{Map US postal codes to US timezones. Compatible with Rails.}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_development_dependency(%q<rake>, [">= 0.9.2"])
|
20
|
+
s.add_development_dependency(%q<rdoc>, [">= 2.4"])
|
21
|
+
s.add_development_dependency(%q<rspec>, [">= 2.7.0"])
|
22
|
+
s.add_runtime_dependency(%q<algorithms>, [">= 0.3"])
|
23
|
+
end
|
24
|
+
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip_to_timezone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Ryan Garver
|
@@ -9,74 +15,122 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-10-21 00:00:00 Z
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
|
-
|
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
|
17
33
|
type: :development
|
18
|
-
|
19
|
-
|
34
|
+
requirement: *id001
|
35
|
+
name: rake
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
20
39
|
requirements:
|
21
40
|
- - ">="
|
22
41
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
42
|
+
hash: 11
|
43
|
+
segments:
|
44
|
+
- 2
|
45
|
+
- 4
|
46
|
+
version: "2.4"
|
47
|
+
prerelease: false
|
48
|
+
type: :development
|
49
|
+
requirement: *id002
|
50
|
+
name: rdoc
|
25
51
|
- !ruby/object:Gem::Dependency
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
+
prerelease: false
|
64
|
+
type: :development
|
65
|
+
requirement: *id003
|
66
|
+
name: rspec
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
30
70
|
requirements:
|
31
71
|
- - ">="
|
32
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 13
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
- 3
|
33
77
|
version: "0.3"
|
34
|
-
|
78
|
+
prerelease: false
|
79
|
+
type: :runtime
|
80
|
+
requirement: *id004
|
81
|
+
name: algorithms
|
35
82
|
description: Map US postal codes to US timezones. Compatible with Rails.
|
36
83
|
email: ragarver@gmail.com
|
37
84
|
executables: []
|
38
85
|
|
39
86
|
extensions: []
|
40
87
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.rdoc
|
88
|
+
extra_rdoc_files: []
|
89
|
+
|
44
90
|
files:
|
45
91
|
- .document
|
46
92
|
- .gitignore
|
93
|
+
- .rspec
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
47
96
|
- LICENSE
|
48
97
|
- README.rdoc
|
49
98
|
- Rakefile
|
50
|
-
- VERSION
|
51
99
|
- lib/zip_to_timezone.rb
|
52
|
-
-
|
100
|
+
- lib/zip_to_timezone/version.rb
|
53
101
|
- spec/spec_helper.rb
|
54
102
|
- spec/zip_to_timezone_spec.rb
|
55
|
-
|
103
|
+
- zip_to_timezone.gemspec
|
56
104
|
homepage: http://github.com/rgarver/zip_to_timezone
|
57
105
|
licenses: []
|
58
106
|
|
59
107
|
post_install_message:
|
60
|
-
rdoc_options:
|
61
|
-
|
108
|
+
rdoc_options: []
|
109
|
+
|
62
110
|
require_paths:
|
63
111
|
- lib
|
64
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
65
114
|
requirements:
|
66
115
|
- - ">="
|
67
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
68
120
|
version: "0"
|
69
|
-
version:
|
70
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
71
123
|
requirements:
|
72
124
|
- - ">="
|
73
125
|
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
74
129
|
version: "0"
|
75
|
-
version:
|
76
130
|
requirements: []
|
77
131
|
|
78
132
|
rubyforge_project:
|
79
|
-
rubygems_version: 1.
|
133
|
+
rubygems_version: 1.8.6
|
80
134
|
signing_key:
|
81
135
|
specification_version: 3
|
82
136
|
summary: Map US postal codes to US timezones
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.4
|