No commit activity in last 3 years
No release in over a year
A ruby wrapper for OPP
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
 Project Readme

Ruby wrapper for the postcode.eu endpoints

https://www.postcode.nl/en/services/adresdata/international

Installation

Add this line to your application's Gemfile:

gem 'international_postcode_api'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install international_postcode_api

Usage

Create an initializer (config/intializers/international_postcode_api.rb)

InternationalPostcodeApi.configure do |config|
  config.api_key      = 'your-API-key'
  config.secret_key   = 'your-secret-key'

  # set new base_uri if new versions are released
  # config.base_uri = 'https://api.postcode.eu/international/v1'

  # Do not switch to Dutch endpoint for Dutch requests will dynamicly switch by default
  # config.dynamic_endpoints = false
end

Methods

All methods can be called from the client object:

  InternationalPostcodeApi::Client.autocomplete('Amsterdam', 'nld')
  required: term
  optional: country_code, default: 'nld'

  InternationalPostcodeApi::Client.details('$1234...')
  required: context

  InternationalPostcodeApi::Client.dutch_postcode('1000AB', '50', 'A')
  required: zipcode, house_number
  optional: house_number_addition, default: nil

  # important!! #postcode only returns a hash with :street and :city dynamicly depending on
  # which endpoint you are using, if you need access to the raw response use #dutch_postcode or #autocomplete + #details

  InternationalPostcodeApi::Client.postcode('1000AB', '50', 'DE')
  required: zipcode, house_number
  optional: country_code, default: 'NL'

  InternationalPostcodeApi::Client.supported_countries