Gems Used: Pry, simplecov, capybara, shoulda-matchers, figaro, faraday, bcrypt, jsonapi-serializer, vcr, webmock
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.
- 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).
* Before running these steps, make sure you have the correct versions of ruby, rails, and the API keys. See Configuration and Keys below *
- Fork and clone this repo
git clone git@github.com:KaraJoHo/sweater_weather.git
- Run bundle install in your terminal
bundle install
- Set up the database by running:
rails db:{drop,create,migrate,seed}
- Run rails s to start the server
rails s
- 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 thepost
requests, you will need to use postman to test those endpoints.
- Ruby version 3.1.1
- Rails version 7.0.4
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.
-
Look under the getting started section for a Weather API key
-
Click on sign up, in Join the Community for a MapQuest API key
-
Finally, to secure and hide your keys, install theFigaro gem. This will give you an
application.yml
file to store your keys for use. -
Enter your API key in
application.yml
API_KEY = 'ENTER YOUR API KEY'
To run tests, type this in your terminal:
bundle exec rspec
All tests should be passing
Endpoints
GET /api/v1/forecast?location=denver,co
POST /api/v1/users
POST /api/v1/sessions
POST /api/v1/road_trip
Reach out anytime on LinkedIn