This repo comprises a simple weather-forecast API, which first geocodes a search parameter to a set of latitude and longitude coordinates, then uses those coordinates to retrieve the current weather. Forecast results for a set of coordinates are cached for 30 minutes.
To hack on the application locally, first clone the repository to your local environment, then bundle install
to install gem dependencies.
To start the server: bin/rails c
To run the test suite: bin/rspec
The API integrates the Geocoder gem to provide an interface for geocoding the provided search parameters. The gem itself provides numerous adapters to different geocoding services. The API here is current configured to perform lookups using the free, fair-use Photon API based on OpenStreetMaps data.
The API performs weather-forecast lookups against the free, fair-use Open-Meteo API.
The API is currently deployed to Heroku. Please contact me if you'd like access
to the existing deployment. Otherwise, it's trivial to provision another
instance. The only addon required is a
MemCachier instance, such that
the MEMCACHIER_SERVERS
, MEMCACHIER_USERNAME
, and MEMCACHIER_PASSWORD
environment variables are set.
A small RSpec test suite is included, with request specs covering most use-cases, and unit tests for important behaviour.