zip-code-info 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +27 -0
- data/VERSION +1 -1
- data/lib/zip-code-info.rb +1 -1
- data/spec/zip-code-info_spec.rb +5 -0
- data/zip-code-info.gemspec +5 -5
- metadata +50 -21
- data/README.rdoc +0 -47
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
## zip-code-info
|
2
|
+
|
3
|
+
This gem returns the state and city of the Sectional Center Facility for a given zip code. It does not use an external service.
|
4
|
+
|
5
|
+
The zip code data has been taken from [http://en.wikipedia.org/wiki/ZIP_code_prefixes](http://en.wikipedia.org/wiki/ZIP_code_prefixes)
|
6
|
+
|
7
|
+
### Usage
|
8
|
+
|
9
|
+
In your Gemfile
|
10
|
+
|
11
|
+
gem "zip-code-info"
|
12
|
+
|
13
|
+
The code runs out of a Singleton class. Right now you can call these two methods.
|
14
|
+
|
15
|
+
ZipCodeInfo.instance.state_for "99163"
|
16
|
+
#=> WA
|
17
|
+
|
18
|
+
ZipCodeInfo.instance.scf_city_for "99163"
|
19
|
+
#=> Spokane
|
20
|
+
|
21
|
+
### Limitations
|
22
|
+
|
23
|
+
* The city returned is the city where the USPS Sectional Center Facility (SCF) is located.
|
24
|
+
* Sometimes the state that a zip code is bound to for USPS is different from the actual state the zip code is in. There are plans to provide both states.
|
25
|
+
|
26
|
+
|
27
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/zip-code-info.rb
CHANGED
@@ -25,7 +25,7 @@ class ZipCodeInfo
|
|
25
25
|
|
26
26
|
def assign_and_validate_code(code)
|
27
27
|
@code = code.to_s
|
28
|
-
return @code.match
|
28
|
+
return @code.match(/^[0-9]{5}$/i) && @data.has_key?(code_to_key)
|
29
29
|
end
|
30
30
|
|
31
31
|
# To look up information we only need the first three digits of the zip code
|
data/spec/zip-code-info_spec.rb
CHANGED
@@ -39,6 +39,11 @@ describe "ZipCodeInfo" do
|
|
39
39
|
zip = ZipCodeInfo.instance.scf_city_for
|
40
40
|
zip.should be_false
|
41
41
|
end
|
42
|
+
|
43
|
+
it "should handle an invalid zip code that has a valid format - 00000" do
|
44
|
+
zip = ZipCodeInfo.instance.scf_city_for("00000")
|
45
|
+
zip.should be_false
|
46
|
+
end
|
42
47
|
|
43
48
|
it "should handle an invalid zip code - too long" do
|
44
49
|
zip = ZipCodeInfo.instance.scf_city_for("123456")
|
data/zip-code-info.gemspec
CHANGED
@@ -5,16 +5,16 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{zip-code-info}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Monica Olinescu"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2012-10-10}
|
13
13
|
s.description = %q{The data has been collected from wikipedia and stored in a yml file. This gem does not use an external service.}
|
14
14
|
s.email = %q{monica.olinescu@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"Gemfile",
|
23
23
|
"Gemfile.lock",
|
24
24
|
"LICENSE.txt",
|
25
|
-
"README.
|
25
|
+
"README.md",
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"data/data.yml",
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
s.homepage = %q{http://github.com/monicao/zip-code-info}
|
36
36
|
s.licenses = ["MIT"]
|
37
37
|
s.require_paths = ["lib"]
|
38
|
-
s.rubygems_version = %q{1.
|
38
|
+
s.rubygems_version = %q{1.6.2}
|
39
39
|
s.summary = %q{Looks up the state and city of the Sectional Center Facility for a given zip code.}
|
40
40
|
s.test_files = [
|
41
41
|
"spec/spec_helper.rb",
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip-code-info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Monica Olinescu
|
@@ -10,63 +15,84 @@ autorequire:
|
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date:
|
18
|
+
date: 2012-10-10 00:00:00 -04:00
|
14
19
|
default_executable:
|
15
20
|
dependencies:
|
16
21
|
- !ruby/object:Gem::Dependency
|
17
|
-
|
22
|
+
prerelease: false
|
23
|
+
type: :development
|
18
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
25
|
none: false
|
20
26
|
requirements:
|
21
27
|
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
23
34
|
version: 1.0.0
|
24
|
-
|
25
|
-
prerelease: false
|
35
|
+
name: bundler
|
26
36
|
version_requirements: *id001
|
27
37
|
- !ruby/object:Gem::Dependency
|
28
|
-
|
38
|
+
prerelease: false
|
39
|
+
type: :development
|
29
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
41
|
none: false
|
31
42
|
requirements:
|
32
43
|
- - ~>
|
33
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 5
|
49
|
+
- 2
|
34
50
|
version: 1.5.2
|
35
|
-
|
36
|
-
prerelease: false
|
51
|
+
name: jeweler
|
37
52
|
version_requirements: *id002
|
38
53
|
- !ruby/object:Gem::Dependency
|
39
|
-
|
54
|
+
prerelease: false
|
55
|
+
type: :development
|
40
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
57
|
none: false
|
42
58
|
requirements:
|
43
59
|
- - ~>
|
44
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 3
|
65
|
+
- 0
|
45
66
|
version: 2.3.0
|
46
|
-
|
47
|
-
prerelease: false
|
67
|
+
name: rspec
|
48
68
|
version_requirements: *id003
|
49
69
|
- !ruby/object:Gem::Dependency
|
50
|
-
|
70
|
+
prerelease: false
|
71
|
+
type: :development
|
51
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
52
73
|
none: false
|
53
74
|
requirements:
|
54
75
|
- - ">="
|
55
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
56
80
|
version: "0"
|
57
|
-
|
58
|
-
prerelease: false
|
81
|
+
name: rcov
|
59
82
|
version_requirements: *id004
|
60
83
|
- !ruby/object:Gem::Dependency
|
61
|
-
|
84
|
+
prerelease: false
|
85
|
+
type: :development
|
62
86
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
87
|
none: false
|
64
88
|
requirements:
|
65
89
|
- - ">="
|
66
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
67
94
|
version: "0"
|
68
|
-
|
69
|
-
prerelease: false
|
95
|
+
name: nokogiri
|
70
96
|
version_requirements: *id005
|
71
97
|
description: The data has been collected from wikipedia and stored in a yml file. This gem does not use an external service.
|
72
98
|
email: monica.olinescu@gmail.com
|
@@ -76,14 +102,14 @@ extensions: []
|
|
76
102
|
|
77
103
|
extra_rdoc_files:
|
78
104
|
- LICENSE.txt
|
79
|
-
- README.
|
105
|
+
- README.md
|
80
106
|
files:
|
81
107
|
- .document
|
82
108
|
- .rspec
|
83
109
|
- Gemfile
|
84
110
|
- Gemfile.lock
|
85
111
|
- LICENSE.txt
|
86
|
-
- README.
|
112
|
+
- README.md
|
87
113
|
- Rakefile
|
88
114
|
- VERSION
|
89
115
|
- data/data.yml
|
@@ -106,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
132
|
requirements:
|
107
133
|
- - ">="
|
108
134
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
135
|
+
hash: 3
|
110
136
|
segments:
|
111
137
|
- 0
|
112
138
|
version: "0"
|
@@ -115,11 +141,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
141
|
requirements:
|
116
142
|
- - ">="
|
117
143
|
- !ruby/object:Gem::Version
|
144
|
+
hash: 3
|
145
|
+
segments:
|
146
|
+
- 0
|
118
147
|
version: "0"
|
119
148
|
requirements: []
|
120
149
|
|
121
150
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.
|
151
|
+
rubygems_version: 1.6.2
|
123
152
|
signing_key:
|
124
153
|
specification_version: 3
|
125
154
|
summary: Looks up the state and city of the Sectional Center Facility for a given zip code.
|
data/README.rdoc
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
= zip-code-info
|
2
|
-
|
3
|
-
This gem returns the state and city of the Sectional Center Facility for a given zip code. It does not use an external service.
|
4
|
-
|
5
|
-
The zip code data has been taken from http://en.wikipedia.org/wiki/ZIP_code_prefixes
|
6
|
-
|
7
|
-
== Usage
|
8
|
-
|
9
|
-
In your Gemfile
|
10
|
-
|
11
|
-
gem zip-code-info
|
12
|
-
|
13
|
-
The code runs out of a Singleton class. Right now you can call these two methods.
|
14
|
-
|
15
|
-
ZipCodeInfo.instance.state_for "99163"
|
16
|
-
#=> WA
|
17
|
-
|
18
|
-
ZipCodeInfo.instance.scf_city_for "99163"
|
19
|
-
#=> Spokane
|
20
|
-
|
21
|
-
== Limitations
|
22
|
-
|
23
|
-
* The city returned is the city where the USPS Sectional Center Facility (SCF) is located.
|
24
|
-
* Sometimes the state that a zip code is bound to for USPS is different from the actual state the zip code is in. There are plans to provide both states.
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
== TODO
|
29
|
-
|
30
|
-
* Ability to return the timezone information from a zip code.
|
31
|
-
* Provide the USPS state as well as the actual state (see limitations).
|
32
|
-
|
33
|
-
== Contributing to zip-code-info
|
34
|
-
|
35
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
36
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
37
|
-
* Fork the project
|
38
|
-
* Start a feature/bugfix branch
|
39
|
-
* Commit and push until you are happy with your contribution
|
40
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
41
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
42
|
-
|
43
|
-
== Copyright
|
44
|
-
|
45
|
-
Copyright (c) 2011 Monica Olinescu. See LICENSE.txt for
|
46
|
-
further details.
|
47
|
-
|