Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Postjoy

Postal codes made easy

Get Started

Add this line to your application’s Gemfile:

gem 'postjoy'

Lookup postal code

Postjoy.find(94109)
# =>
{
  city: "San Francisco",
  state: "California",
  state_code: "CA",
  latitude: 37.7917,
  longitude: -122.4186
}

Returns nil if the postal code does not exist

Validations

Also adds validations for Rails

class Address < ActiveRecord::Base
  validates :postal_code, postal_code: true
end

Credit

Data from GeoNames

TODO

  • international postal codes

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To update postal codes, download the updated list from GeoNames to US.txt and run:

rake create

About

Postal codes made easy

Resources

License

Packages

No packages published

Languages