Git Product home page Git Product logo

ziptedu's Introduction

Ziptedu

Build Status

Collection of data and utilities to lookup postal-code based location information. This gem is HEAVILY INSPIRED by Thomas Leen's zippity-do-dah (Node.js module that does pretty much the same thing).

Functions for looking up zipcode, city, state, latitude and longitude using a zipcode, city + state, or latitude + longitude. You can also get random sets of this data.

Data sourced from federalgovernmentzipcodes.us. This is primary data, meaning data that maps to multiple locations will return only the primary location.

NOTE: The data is self-contained inside the gem, so no internet connection is required in order to use it.

Installation

Add this line to your application's Gemfile:

gem 'ziptedu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ziptedu

Usage

require('ziptedu')

puts Ziptedu.random(3)
puts Ziptedu.zipcode(21208).city
puts Ziptedu.random
puts Ziptedu.citystate("Baltimore", "MD")
puts Ziptedu.latlong('32.09', '-96.71')

API

Lookups

All lookups will return nil (if lookup was unsuccessful) or an instance of Ziptedu::Zipcode class with the following attributes:

  • zipcode
  • type (standard, military, po box)
  • city
  • state
  • latitude
  • longitude

These attributes may be empty if not applicable to the specific location returned.

.zipcode(zipcode)

Lookup data by 5 digit zipcode (the argument can be either an integer or a string)

.citystate(city, state)

Lookup data by city and state, capitalization does not matter.

.latlong(latitude, longitude)

Lookup date by latitude and longitude, lat/long must have two decimal digits only (-)xx.xx.

Utilities

.random([number])

Will return a single random result, if number is specified and > 1 will return an array of random results.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kalmanh/ziptedu.

License

The gem is available as open source under the terms of the MIT License.

ziptedu's People

Contributors

kalmanh avatar

Stargazers

Tom Leen avatar

Watchers

 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.