🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

world-postalcodes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

world-postalcodes

bundlerRubygems
Version
1.0.3
Version published
Maintainers
1
Created
Source

World-Postalcodes Gem Version

A simple gem to search city, state, state code, latitude, longitude, timezone and country details from postal code only for USA, India & Japan. All details has been stored in yaml file. We will be adding postal code details for more countries soon.

Note: You need around 45MB free space in your system or server to use this gem.

Installation

Add this line to your application's Gemfile:

gem 'world-postalcodes'

And then execute:

$ bundle

Or install it yourself as:

$ gem install world-postalcodes

Usage


require "world_postalcodes"

WorldPostalcodes.search("04574")
# => {:city=>"Washington", :state=>"Maine", :state_code=>"ME", :latitude=>44.2693, :longitude=>-69.3842, :time_zone=>"America/New_York", :country=>"United States"}

WorldPostalcodes.search('382481')
# => {:city=>"Ahmedabad", :state=>"GUJARAT", :post_office=>"Nirnaynagar", :taluka_name=>"Ahmadabad, :district_name=>"Ahmedabad", :head_office=>"Gandhinagar (Gujarat)", :sub_office=>"NA", :country=>"India"}

WorldPostalcodes.search("441-3106")
# => {:city=>"Toyohashishi", :state=>"Aichiken", :latitude=>34.7246, :longitude=>137.476, :country=>"Japan"}

# First run will take a while, as the yaml has to be loaded.

If you are using Rails, you can load the yaml file on app startup for production and staging.

# config/initializers/load_pin_codes.rb
WorldPostalcodes.load unless Rails.env.development?

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 14 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts