thelookoutway / postcoder

Microservice to return surrounding postcodes given an Australian postcode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.


Languages

Language:Ruby 75.4%Language:Nix 22.8%Language:Shell 1.8%Language:Procfile 0.0%