Sweater Weather was a 7-day solo project for Turing School's Back End Engineering Program
- Sweater Weather
- Overview
- Learning Goals
- Features
- API Endpoints
- Usage Examples
- Tools Used
- How to Contribute
- Personal Info
Sweater Weather is a Rails API that provides the information necessary to build a front-end application. It uses its access to MapQuest routing features and OpenWeather forecasts to provide a user with details about a potential road trip.
This project was intended as an exercise to practice:
- Exposing API endpoints
- Aggregating and exposing data from external APIs
- API-based CRUD functionality
- API key generation; token-based authentication
- Building endpoints based on front-end wireframes
- Data manipulation; complex method implementation
Upon registration with an email address, users are provided with a unique API key. This key can then be used to access the Road Trip endpoint. By combining MapQuest's Route service with OpenWeather's Onecall service, this application can display the travel time to a user's chosen destination along with the predicted weather forecast at their time/date of arrival.
In addition, this app allows for:
- Keyword-based forecast searches by location using OpenWeather's Onecall service
- Keyword-based background image searches using Pexels's Image service
- Session creation with user authentication
- API-key authentication
- Custom error-handling messages to control for sad paths/edge cases
Feature | Endpoint |
---|---|
Retrieve forecast for location | GET /api/v1/forecast?location={location} |
Retrieve background image | GET /api/v1/backgrounds?location={location} |
Create User | POST /api/v1/users (JSON body required) |
Login User | POST /api/v1/sessions (JSON body required) |
Create new Road Trip | POST /api/v1/road_trip (JSON body required) |
Endpoint: GET /api/v1/forecast?location=sandiego
Response:
Endpoint: POST /api/v1/road_trip
JSON Body:
{
"origin": "Vista, CA",
"destination": "Denver, CO",
"api_key": "[KEY]"
}
Response:
Development | Gems | Testing |
---|---|---|
Ruby on Rails | Faraday | RSpec |
VSCode | Pry | Postman |
Git | SimpleCov | Shoulda-Matchers |
GitHub | Factory Bot (Rails) | VCR |
Rubocop (Rails) | Webmock | |
Figaro | ||
FastJSON API | ||
BCrypt |
- Fork it (https://github.com/InOmn1aParatus/sweater_weather/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request
👤 Matt Kragen