Code Monkey home page Code Monkey logo

postjoy's Introduction

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

postjoy's People

Contributors

ankane avatar mmorrison avatar

Stargazers

STYLIANOS IORDANIS avatar Pawneet Singh avatar Julien Malherbe avatar Giovanni Kock Bonetti avatar Kilim Choi avatar Kent Gruber avatar Igor Zubkov avatar Eric Kreutzer avatar John Backus avatar James Gifford avatar Barnett Klane avatar Manthan Damania avatar

Watchers

 avatar James Cloos avatar Julien Malherbe avatar Pawneet Singh avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.