Skip to content

rlew421/sweater_weather

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Sweater Weather

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.

Table of Contents

About The Project

Sweater Weather Postman Request

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:

  1. Retrieve weather for a city (hourly, daily, and weekly forecasts)
GET /api/v1/forecast?location=denver,co
  1. Retrieve a background image for a city
GET /api/v1/backgrounds?location=denver,co
  1. Register as a user and receive a unique API key in return
POST /api/v1/users
  1. Log in as a user using your unique API key
POST /api/v1/sessions
  1. Get estimated travel time between two cities and the forecast upon arrival in the destination city
POST /api/v1/road_trip

Built With

Getting Started

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.

Prerequisites

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

Installation

  1. Get API keys from Google Geocoding, Google Geolocation, Dark Sky, and Unsplash. See built with section.

  2. Clone the repo

git clone https://github.com/rlew421/sweater_weather.git
  1. Install gems
bundle install
  1. Install figaro and enter your API keys in application.yml
figaro install

Usage

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.

  1. Retrieve weather for a city (hourly, daily, and weekly forecasts)
GET /api/v1/forecast?location=denver,co

Forecast Postman Request

  1. Retrieve a background image for a city
GET /api/v1/backgrounds?location=denver,co

Image Postman Request

  1. 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

Registration Postman Request

  1. Log in as a user. Email and password must be passed through in request body as shown.
POST /api/v1/sessions

Login Postman Request

  1. 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

Roadtrip Postman Request

To make requests locally, replace floating-lake-73630.herokuapp.com with localhost:3000.

Contact

Rachel Lew - LinkedIn - [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published