DanielWright / tek-forecast

Proof-of-concept weather forecast API.
https://powerful-reef-46727.herokuapp.com/forecast
MIT License
0 stars 0 forks source link

Weather Forecast API

CircleCI

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.

Toolchain

Setting Up

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

External Dependencies

Geocoding

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.

Weather

The API performs weather-forecast lookups against the free, fair-use Open-Meteo API.

Deployment

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.

Testing

A small RSpec test suite is included, with request specs covering most use-cases, and unit tests for important behaviour.