Locus
Get information about postal codes.
Currently only 'admin code1' and 'admin name1' are looked up (1. order subdivision (state)).
Uses data files from geonames.org.
Installation
Add this line to your application's Gemfile:
gem 'locus'
Or install it yourself as:
$ gem install locus
Usage
Locus::Place.find_by_postal_code('12053', :de).state_code # => 'BE'
A data file for DE, CH and AT is included with the gem. To update your data file:
wget http://download.geonames.org/export/zip/{DE,AT,CH}.zip
# unzip ...
rake locus:import:zip[postal_codes.yml,"DE.txt CH.txt AT.txt"]`
Tell the gem to use your updated data file:
Locus.zip_path = '/path/to/updated/postal_codes.yml'
Changes
0.2.x
- format of data file changed. Use the new provided file or update yours using the rake task
Contributing
Awesome :-)