Project

postjoy

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Postal codes made easy
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6
>= 0
 Project Readme

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