Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
/ postcoder Public archive
forked from aldhsu/postcoder

Microservice to return surrounding postcodes given an Australian postcode.

Notifications You must be signed in to change notification settings

thelookoutway/postcoder

 
 

Repository files navigation

Postcoder Build status

https://postcoder.thelookoutway.net/

Microservice to return surrounding postcodes given an Australian postcode. Leverages the australia_postcode gem. All distance calculations are performed in memory.

System Dependencies

  • Ruby MRI 3.1.2
  • Rails 7.0.2.3
  • API_TOKEN secret environment variable
  • direnv (recommended for development)
  • nix (recommended for development)

There's no database, australia_postcode reads data from a CSV.

Usage

The service only has one endpoint, /. Target this with a GET request, supplying the api_token and postcode query parameters, and you'll receive a JSON response of the shape:

{
  "3": [<array of integer postcodes>],
  "7": [<array of integer postcodes>],
  "10": [<array of integer postcodes>],
  "20": [<array of integer postcodes>],
}

e.g.:

$ curl "http://localhost:3000/?api_token=ASDF&postcode=2752"
# => {"3":[2752],"7":[2570,2752],"10":[2570,2745,2752],"20":[2555,2556,2557,2567,2570,2745,2752,2773]}

Development

Install the application's dependencies:

$ bundle

Start the application server:

$ bundle exec rails server

Testing

Run the entire test suite.

$ bundle exec rspec

Deploying

This application is automatically deployed when commits are pushed to the main branch and the tests on the main branch pass.

About

Microservice to return surrounding postcodes given an Australian postcode.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Ruby 75.4%
  • Nix 22.8%
  • Shell 1.8%