Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
source "http://rubygems.org"

gem 'debugger', '~> 1.2.0'
#gem 'debugger', '~> 1.2.0'
gem 'rspec'
gem "guard", '~> 1.3.2'
gem 'guard-rspec', '~> 1.2.1'
gem 'guard-spork', '~> 1.1.0'
gem 'rb-fsevent', '~> 0.9.1'
gem 'active_support'
gem "guard"
gem 'guard-rspec'
gem 'guard-spork'
gem 'rb-fsevent'
gem 'activesupport'
114 changes: 77 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,47 +1,87 @@
GEM
remote: http://rubygems.org/
specs:
active_support (3.0.0)
activesupport (= 3.0.0)
activesupport (3.0.0)
columnize (0.3.6)
debugger (1.2.0)
columnize (>= 0.3.1)
debugger-linecache (~> 1.1.1)
debugger-ruby_core_source (~> 1.1.3)
debugger-linecache (1.1.2)
debugger-ruby_core_source (>= 1.1.1)
debugger-ruby_core_source (1.1.3)
diff-lcs (1.1.3)
guard (1.3.2)
listen (>= 0.4.2)
thor (>= 0.14.6)
guard-rspec (1.2.1)
guard (>= 1.1)
guard-spork (1.1.0)
guard (>= 1.1)
activesupport (4.2.5)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
childprocess (0.5.8)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
diff-lcs (1.2.5)
ffi (1.9.10)
formatador (0.2.5)
guard (2.13.0)
formatador (>= 0.2.4)
listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.6.4)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
guard-spork (2.1.0)
childprocess (>= 0.2.3)
guard (~> 2.0)
guard-compat (~> 1.0)
spork (>= 0.8.4)
listen (0.5.0)
rb-fsevent (0.9.1)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.2)
spork (1.0.0rc3)
thor (0.16.0)
i18n (0.7.0)
json (1.8.3)
listen (3.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.9)
method_source (0.8.2)
minitest (5.8.3)
nenv (0.2.0)
notiffany (0.0.8)
nenv (~> 0.1)
shellany (~> 0.0)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.1)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
shellany (0.0.1)
slop (3.6.0)
spork (0.9.2)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
active_support
debugger (~> 1.2.0)
guard (~> 1.3.2)
guard-rspec (~> 1.2.1)
guard-spork (~> 1.1.0)
rb-fsevent (~> 0.9.1)
activesupport
guard
guard-rspec
guard-spork
rb-fsevent
rspec

BUNDLED WITH
1.10.6
3 changes: 2 additions & 1 deletion lib/tzip/values/central.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module TZip
ZONINGS[:central] = %w{35 36 370 3720 3723 381 383 39 }
ZONINGS[:central] = %w{35 36 370 3720 3723 381 383 384 39 }
ZONINGS[:central] += %w{4641}
ZONINGS[:central] += %w{50 51 52 53 54 55 56 57 581 582 585 }
ZONINGS[:central] += %w{60 61 62 63 64 65 660 661 6660 672 680 681 685}
ZONINGS[:central] += %w{7}

end
2 changes: 1 addition & 1 deletion lib/tzip/values/eastern.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module TZip
ZONINGS[:eastern] = %w{0 1 2}
ZONINGS[:eastern] += %w{30 31 32 33 34 376 379 398 399}
ZONINGS[:eastern] += %w{402 405 410 43 44 45 460 462 462 480 481 482 483 485 488 489 490 495 496 }
ZONINGS[:eastern] += %w{402 405 410 43 44 45 460 462 462 480 481 482 483 484 485 488 489 490 492 495 496 }
ZONINGS[:eastern] += %w{569}
end
2 changes: 1 addition & 1 deletion lib/tzip/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module TZip
VERSION = "0.0.4" unless defined?(::TZip::VERSION)
VERSION = "0.0.7" unless defined?(::TZip::VERSION)
end
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

TZip makes it a little bit easier to set TimeZones in a rails app, since it can figure out the appropriate identifier from a ZIP code.

[ ![Codeship Status for chiron-health/TZip](https://codeship.com/projects/ff254ae0-818e-0133-f841-224be51da39b/status?branch=master)](https://codeship.com/projects/121276)

## Install & Implement ##

$ gem install tzip
Expand All @@ -13,4 +15,4 @@ TZip makes it a little bit easier to set TimeZones in a rails app, since it can

# Set the default time zone for a Rails app
# Rails configuration file (config/application.rb or config/environments/development.rb, etc)
config.time_zone = ActiveSupport::TimeZone.find_by_zipcode('90210')
config.time_zone = ActiveSupport::TimeZone.find_by_zipcode('90210')
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'rubygems'
require 'spork'
require 'spork/ext/ruby-debug'
#require 'spork/ext/ruby-debug'
require 'active_support'
require 'rspec'

Expand Down
24 changes: 22 additions & 2 deletions spec/tzip_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require "spec_helper"
describe TZip do

# Alaska
%w(99615 99615 99927).each{|zip|
it { print zip; lookup_zip(zip).should == 'Alaska' }
Expand All @@ -17,7 +16,7 @@
}

# Eastern
%w(00926 08701 11226 23464 28269 30043 30044 48201 48109 32308 37604 37917 32207 32216 41017 40502 46032 48124 48197 48307 48532 48912 49008 49546 49684 48503 ).each{|zip|
%w(00926 08701 11226 23464 28269 30043 30044 48201 48109 32308 37604 37917 32207 32216 41017 40502 46032 48124 48197 48307 48532 48912 49008 49546 49684 48503 49242).each{|zip|
it { print zip; lookup_zip(zip).should == 'Eastern Time (US & Canada)' }
}

Expand All @@ -36,4 +35,25 @@
it { print zip; lookup_zip(zip).should == 'Pacific Time (US & Canada)' }
}

describe '.find_by_zipcode' do
context 'Tennessee' do
let(:zips) { %w(38464) }
let(:timezone) { 'Central Time (US & Canada)' }
it 'matches Central Time (US & Canada)' do
zips.each do |zip|
expect(lookup_zip(zip)).to eq timezone
end
end
end

context 'Michigan' do
let(:zips) { %w(48439) }
let(:timezone) { 'Eastern Time (US & Canada)' }
it 'matches Eastern Time' do
zips.each do |zip|
expect(lookup_zip(zip)).to eq(timezone), zip
end
end
end
end
end