0.0
No commit activity in last 3 years
No release in over 3 years
A light-weight gem, get valid US zipcode/city/states from any string.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies

Development

>= 0

Runtime

~> 1.5
 Project Readme

AutoLoc

If a string contains a US zipcode/city/state, this gem will convert it into a parsed ruby object including a valid location.

Install

Add the following into your Rails Gemfile

  gem 'auto_location'

Then run bundler to install

  $ bundle 
  or 
  $ bundle install

Or install directly on command line

  $ gem install auto_location

Update

In version 0.0.4, added county support.

Usage Example

After the gem is installed, in Ruby Code:

 '95129'.validated_location => {location: {zipcode: '95129', city: "San Jose", state: "CA"}, type: 'zipcode'}
 'San Jose, CA'.validated_location => {location: {city: "San Jose", state: "CA"}, type: 'city'}
 'CA'.validated_location => {location: 'CA', type: 'state'}
 'Orange County, CA'.validated_location =>  {location: {county: "Orange County", state: "CA"}, type: 'county'}

The string can also include some unuseful info:

  'San Jose, Wait! Where am I???'.validated_location => {location: {city: "San Jose", state: "CA"}, type: 'city'}

If the string is not able to be parsed:

  '1428 random text, 35000, San Josa, CC'.validated_location => {error: "Location Not Found"}

Notice

The geo location data in the gem doesn't contain all location in US, and some of the parsing logic may not meet your requirement. But! We will make it better!