zip_to_timezone 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  This gem is designed to map US postal codes to the timezone. The timezone strings are based on ActiveSupport::TimeZone settings that include basic DST information. If used with Rails these timezones will handle DST changes on their own.
4
4
 
5
+ == Installation
6
+
7
+ gem install zip_to_timezone
8
+
9
+ This gem is hosted on gemcutter so you may need to add it as a source:
10
+
11
+ gem install gemcutter
12
+ gem tumble
13
+
14
+ == Usage
15
+
16
+ This is super simple to use:
17
+
18
+ ZipToTimezone.get_timezone_for('91304') # => "Pacific Time (US & Canada)"
19
+
20
+ == How it works
21
+
22
+ This uses Trei longest prefix matching to speed up the searching. This means that all zip codes that start with 90 will be in California and therefore are in Pacific Time. If I need to match on full zip codes in some states to differentiate timezones I can do that (eg: Kansas or Indiana) by just adding more specific entires.
23
+
24
+ == Note on accuracy
25
+
26
+ This gem combines two things that kind of suck to make them suck less. To do this though I had to make a lot of guesses. Please let me know if there are bad mappings so I can fix them. My data is imperfect and in some places outright wrong. The goal of the project was to handle the 95% case and hopefully grow it to be more accurate over time.
27
+
28
+ == References
29
+
30
+ * http://www.worldtimezone.com/time-usa12.php
31
+ * http://en.wikipedia.org/wiki/ZIP_code_prefixes
32
+
5
33
  == Note on Patches/Pull Requests
6
34
 
7
35
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -1,9 +1,4 @@
1
- begin
2
- require 'algorithms'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'algorithms'
6
- end
1
+ require 'algorithms'
7
2
 
8
3
  class ZipToTimezone
9
4
  MAPPINGS = {
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rubygems'
3
4
  require 'zip_to_timezone'
4
5
  require 'spec'
5
6
  require 'spec/autorun'
6
7
 
7
8
  Spec::Runner.configure do |config|
8
-
9
+
9
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_to_timezone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Garver