A JSON API that returns forecasts and background images for a city and estimated travel time between an origin and destination through five RESTful routes.
Sweater Weather is a JSON API that consumes several external APIs (Google Geocoding API, Google Geolocation API, Dark Sky API, Unsplash API) and aggregates and manipulates data for a user. A visitor can retrieve hourly/daily/weekly forecasts/background image for a city, register as a user and receive a unique API key, log in, and plan a road trip that tells them the estimated travel time to and expected forecast in the destination city.
Sweater Weather returns data for the following five endpoints:
- Retrieve weather for a city (hourly, daily, and weekly forecasts)
GET /api/v1/forecast?location=denver,co
- Retrieve a background image for a city
GET /api/v1/backgrounds?location=denver,co
- Register as a user and receive a unique API key in return
POST /api/v1/users
- Log in as a user using your unique API key
POST /api/v1/sessions
- Get estimated travel time between two cities and the forecast upon arrival in the destination city
POST /api/v1/road_trip
To make API calls to the production application, skip to usage. If you'd like to get a local copy up and running, follow these steps.
If Ruby is not already installed, install Ruby with the following commands
- ruby
brew install rbenv
rbenv install 2.4.1
If Rails is not already installed, install Rails with the following commands
- rails
gem install rails
-
Get API keys from Google Geocoding, Google Geolocation, Dark Sky, and Unsplash. See built with section.
-
Clone the repo
git clone https://github.com/rlew421/sweater_weather.git
- Install gems
bundle install
- Install figaro and enter your API keys in
application.yml
figaro install
To make API calls to the production application, skip this command. To make requests in your local environment, start the server with the following command.
rails s
Use Postman to make requests to the API. For the production application, prefix the following requests with
https://floating-lake-73630.herokuapp.com
. Examples are provided.
- Retrieve weather for a city (hourly, daily, and weekly forecasts)
GET /api/v1/forecast?location=denver,co
- Retrieve a background image for a city
GET /api/v1/backgrounds?location=denver,co
- Register as a user and receive a unique API key in return. Email, password, and password confirmation must be passed through in request body as shown.
POST /api/v1/users
- Log in as a user. Email and password must be passed through in request body as shown.
POST /api/v1/sessions
- Get estimated travel time between two cities and the forecast upon arrival in the destination city. Origin, destination, and API key must be passed in through request body as shown.
POST /api/v1/road_trip
To make requests locally, replace floating-lake-73630.herokuapp.com
with localhost:3000
.
Rachel Lew - LinkedIn - [email protected]