zippopotamus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +85 -0
- data/Rakefile +2 -0
- data/lib/zippopotamus.rb +5 -0
- data/lib/zippopotamus/version.rb +3 -0
- data/zippopotamus.gemspec +26 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f6f4207cd0e0261fd5c8a46db7f3accec6914726
|
4
|
+
data.tar.gz: 6805d33abf5714157272cd596ea668d5c4d48ac1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a151478bca1796593994c504bfbbf5bcb06e43aba5aa037ea1d8622d02c118d9344fac368fbf4dbec220e0b9d2fdae77336efc3556c2397390d89b309e55911
|
7
|
+
data.tar.gz: 98be9804d4ed5e757916499b8fd513fe90192e827754b9ce2c8030dadd7796e1ab01cf010602a9dcdb58b55cc74a96ec46c0d4257d96a1050e2760cef371a4ed
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Ryan McGeary
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Zippopotamus [![Gem Version](http://img.shields.io/gem/v/zippopotamus.svg)](https://rubygems.org/gems/zippopotamus) [![Build Status](https://img.shields.io/travis/rmm5t/zippopotamus.svg)](http://travis-ci.org/rmm5t/zippopotamus)
|
2
|
+
|
3
|
+
Ruby wrapper around the Zippopotam.us API. **Zip Code Galore!** Postal Codes and Zip Codes made easy.
|
4
|
+
|
5
|
+
* Give it a postal code to get back the city, state, longitude, and latitude.
|
6
|
+
* Give it a city and state to get back a list of possible postal codes.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem "zippopotamus"
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install zippopotamus
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require "zippopotamus"
|
28
|
+
|
29
|
+
# ============================================================
|
30
|
+
# Lookup the city, state, long, and lat by postal code (defaults to "US").
|
31
|
+
#
|
32
|
+
places = Zippopotamus.by_postal_code("90210")
|
33
|
+
places.size # => 1
|
34
|
+
place = places.first
|
35
|
+
place.country # => "United States"
|
36
|
+
place.country_abbreviation # => "US"
|
37
|
+
place.state # => "California"
|
38
|
+
place.state_abbreviation # => "CA"
|
39
|
+
place.place_name # => "Beverly Hills"
|
40
|
+
place.post_code # => "90201"
|
41
|
+
place.longitude # => "-118.4065"
|
42
|
+
place.latitude # => "34.0901"
|
43
|
+
|
44
|
+
# Also aliased as `by_zip`
|
45
|
+
places = Zippopotamus.by_zip("90210")
|
46
|
+
|
47
|
+
# Specify a different country
|
48
|
+
places = Zippopotamus.by_postal_code("4400", "AU")
|
49
|
+
place = places.first
|
50
|
+
place.country # => "Australia"
|
51
|
+
place.country_abbreviation # => "AU"
|
52
|
+
place.state # => "Queensland"
|
53
|
+
place.state_abbreviation # => "QLD"
|
54
|
+
place.place_name # => "Kingsthorpe"
|
55
|
+
place.post_code # => "4400"
|
56
|
+
place.longitude # => "151.8333"
|
57
|
+
place.latitude # => "-27.4667"
|
58
|
+
|
59
|
+
# ============================================================
|
60
|
+
# Lookup the postal code by city and state (defaults to "US").
|
61
|
+
#
|
62
|
+
places = Zippopotamus.by_name("Belmont", "MA", "US")
|
63
|
+
places.size # => 2
|
64
|
+
places[0].country # => "United States"
|
65
|
+
places[0].country_abbreviation # => "US"
|
66
|
+
places[0].state # => "Massachusetts"
|
67
|
+
places[0].state_abbreviation # => "MA"
|
68
|
+
places[0].place_name # => "Belmont"
|
69
|
+
places[0].post_code # => "02178"
|
70
|
+
places[0].longitude # => "-71.4594"
|
71
|
+
places[0].latitude # => "34.0901"
|
72
|
+
# ---
|
73
|
+
places[1].post_code # => "02478"
|
74
|
+
places[1].longitude # => "-71.2044"
|
75
|
+
places[1].latitude # => "42.4128"
|
76
|
+
```
|
77
|
+
|
78
|
+
|
79
|
+
## Contributing
|
80
|
+
|
81
|
+
1. Fork it ( https://github.com/[my-github-username]/zippopotamus/fork )
|
82
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
83
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
84
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
85
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/zippopotamus.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zippopotamus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zippopotamus"
|
8
|
+
spec.version = Zippopotamus::VERSION
|
9
|
+
spec.authors = ["Ryan McGeary"]
|
10
|
+
spec.email = ["ryan@mcgeary.org"]
|
11
|
+
spec.summary = "Ruby wrapper around the Zippopotam.us API."
|
12
|
+
spec.description = "Lookup the city, state, longitude, and latitude for a given country and postal code, or lookup a list of possible postal codes for a given country, state, and city."
|
13
|
+
spec.homepage = "https://github.com/rmm5t/zippopotamus"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency "rest-client", "~> 1.4"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.5"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zippopotamus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan McGeary
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.5'
|
69
|
+
description: Lookup the city, state, longitude, and latitude for a given country and
|
70
|
+
postal code, or lookup a list of possible postal codes for a given country, state,
|
71
|
+
and city.
|
72
|
+
email:
|
73
|
+
- ryan@mcgeary.org
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/zippopotamus.rb
|
84
|
+
- lib/zippopotamus/version.rb
|
85
|
+
- zippopotamus.gemspec
|
86
|
+
homepage: https://github.com/rmm5t/zippopotamus
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.5
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Ruby wrapper around the Zippopotam.us API.
|
110
|
+
test_files: []
|