Skip to content

KaraJoHo/sweater_weather

Repository files navigation


Sweater Weather

Module 3 Final Project
Turing School of Software and Design
Cohort: 2211 Back End

Built With

Ruby Ruby on Rails Rspec Badge Postgresql GitHub VSCode

Gems Used: Pry, simplecov, capybara, shoulda-matchers, figaro, faraday, bcrypt, jsonapi-serializer, vcr, webmock

About The Project


Sweater Weather is the final project for the Turing School's module 3 back end program. Throughout module 3, we have learned about consuming and exposing APIs. This project allows students to replicate what could be a real world example of working with the front end team, by exposing an API that the front end can use.
Sweater Weather will allow users to not only see the duration of their road trip, but the forecasted weather at their destination once they arrive.

Learning Goals


  • Expose an API that aggregates data from multiple external APIs
  • Expose an API that requires an authentication token
  • Expose an API for CRUD functionality
  • Determine completion criteria based on the needs of other developers
  • Test both API consumption and exposure, making use of at least one mocking tool (VCR, Webmock, etc).

(back to top)

Getting Started

* Before running these steps, make sure you have the correct versions of ruby, rails, and the API keys. See Configuration and Keys below *

  1. Fork and clone this repo git clone git@github.com:KaraJoHo/sweater_weather.git
  2. Run bundle install in your terminal bundle install
  3. Set up the database by running: rails db:{drop,create,migrate,seed}
  4. Run rails s to start the server rails s
  5. Open postman to test the endpoints If you don't have postman, go to https://www.postman.com to install it and read about use. You can access one endpoint from your browser by searching http://localhost:3000/api/v1/forecast?location=denver,co
    However, for the post requests, you will need to use postman to test those endpoints.

Configuration

  • Ruby version 3.1.1
  • Rails version 7.0.4

Keys

This project uses both Mapquest and WeatherAPI. Keys are free and easy to get, and will be needed to properly run this on your local machine. See the links below to get your own keys, and where/how to use them.

  1. Look under the getting started section for a Weather API key

  2. Click on sign up, in Join the Community for a MapQuest API key

  3. Finally, to secure and hide your keys, install theFigaro gem. This will give you an application.yml file to store your keys for use.

  4. Enter your API key in application.yml

    API_KEY = 'ENTER YOUR API KEY'

(back to top)

Testing

To run tests, type this in your terminal:

bundle exec rspec

All tests should be passing


Schema


Endpoint Requests and Responses

Here are some examples of requests and responses ran in Postman.


Endpoints

GET /api/v1/forecast?location=denver,co



POST /api/v1/users



POST /api/v1/sessions



POST /api/v1/road_trip





(back to top)

Contact

Reach out anytime on LinkedIn

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published