Postcodeapi
API wrapper for postcodeapi.nu zipcode api.
Installation
Add this line to your application's Gemfile:
gem 'ww-postcodeapi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ww-postcodeapi
Setup
Add file config/initializers/postcodeapi.rb
.
require 'postcodeapi'
Postcodeapi.configure do |config|
config.api_key = "1234567890abcdefghizjklmnopqrstuvwxyz"
end
Example usage
Get an address for a zipcode:
response = Postcodeapi.get_street("5041EB")
# => #<OpenStruct street="Wilhelminapark", postcode="5041EB", town="Tilburg", latitude=51.9401, longitude=5.61531, x=133505, y=397537>
You can then use:
response.street
# => "Wilhelminapark"
response.town
# => "Tilburg"
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