This is a backend API that provides the foundation for a weather application. This application can be used to to communicate with a frontend application using five API JSON endpoints. It stores only user information in the database, and all of the weather and location based data are consumed via third party APIs.
This project was tested with:
- RSpec version 3.10
- Postman Explore and test the API endpoints using Postman, and use Postman’s CLI to execute collections directly from the command-line.
- Getting Started
- Endpoints
- Database Schema
- Testing
- How to Contribute
- Roadmap
- Contributors
- Acknowledgments
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system. Endpoints can be added. If you plan to use this engine with the frontend web application, if the endpoints are changed subsequent updates will be necessary on the Frontend repository code.
-
Ruby
- The project is built with rubyonrails using ruby version 2.5.3p105, you must install ruby on your local machine first. Please visit the ruby home page to get set up. Please ensure you install the version of ruby noted above.
-
Rails
gem install rails --version 5.2.5
-
Postgres database
- Visit the postgresapp homepage and follow their instructions to download the latest version of Postgres app.
-
Mapquest API
- Visit the mapquest developer tools to create an account and follow the instructions to obtain an api key.
-
OpenWeatherMap API
- Visit the OpenWeatherMap API to create an account and follow the instructions to obtain an api key.
-
Unsplash API
- Visit the Unsplash developers tools to create an account and follow the instructions to obtain an api key.
- Clone the repo
$ git clone https://github.com/Yardsourcing/yardsourcing-frontend
- Bundle Install
$ bundle install
- Create, migrate and seed rails database
$ rails db:{create,migrate}
- Set up Environment Variables:
- run
bundle exec figaro install
- add the below variable to the
config/application.yml
for the existing third party API service calls.
mapquest_key: <your_api_key>
open_weather_key: <your_api_key>
unsplash_key: <your_api_key>
GET /api/v1/forecast GET /api/v1/backgrounds POST /api/v1/users POST /api/v1/sessions POST /api/v1/road_trip
HTTP verbs | Paths | Used for |
---|---|---|
GET | /api/v1/forecast | Get the forecast for a city, state. It includes the forecast for current, 48 hours and 7 days. |
GET | /api/v1/backgrounds | Get an image that can be used as a background using city, state |
POST | /api/v1/users | Create a new user and generate a unique api key |
POST | /api/v1/sessions | Login an existing user |
POST | /api/v1/road_trip | Create a road trip and provides the forecast for the destination upon arrival |
Please see the API Documentation for detailed information about each endpoint, existing parameters, and expected json data input and output.
- To run the full test suite run the below in your terminal:
$ bundle exec rspec
- To run an individual test file run the below in tour terminal:
$ bundle exec rspec <file path>
for example: bundle exec rspec spec/requests/api/v1/forecast/index_spec.rb
- To run postman endpoints, start the Sweater Weather application locally
rails s
- Utilize this link to download the postman suite
In the spirit of collaboration, things done together are better than done on our own. If you have any amazing ideas or contributions on how we can improve this API they are greatly appreciated. To contribute:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See the open issues for a list of proposed features (and known issues). Please open an issue ticket if you see an existing error or bug.
See also the list of contributors who participated in this project.
- My amazing and supportive Instructors at Turing School of Software and Design:
- Ian Douglas
- Alex Robinson
- Tim Tyrell