Find the local forecast for your upcoming Road Trip!
Before getting started with installation, you will need to get an API key from
MapQuest's Geocoding API,
OpenWeather One Call API,
and Flickr API.
Please sign up to get your own copy and include them as environment variables with Figaro.
Run figaro install to add your own application.yml file to the application.
View the Postman documentation here: Postman Collection
These instructions will get you up and running with a copy of the project on your local machine for development and testing purposes.
- Fork and Clone this repo
- Install gem packages:
bundle install - Run
rails db:{drop,create,migrate,seed}-- (you may see errors from pg_restore that you can ignore) - Run rails s to start the rails server
- Enter endpoints (see below) into Postman to see JSON responses!
You will need to have Redis installed on your local machine to run the test suite correctly.
Please follow these instructions to install Redis: Redis.
Run redis-server before running the test suite.
Make sure you have run bundle install and that the Brakeman gem was successfully installed.
To see a report run brakeman -q
GET localhost:3000/api/v1/forecast
- Enter a city and state with a 'location' query parameter, ex: 'Tampa,FL'
- Change the units of temperature by including a 'units' parameter, ex: 'metric'
"data": {
"id": "null",
"type": "forecast",
"attributes": {
"current_weather": {
"datetime": "2021-04-24T12:08:35.000-04:00",
"sunrise": "2021-04-24T06:55:42.000-04:00",
"sunset": "2021-04-24T19:59:47.000-04:00",
"temperature": 83.16,
etc...
}
}...
GET localhost:3000/api/v1/backgrounds
- Enter a city and state with a 'location' query parameter, ex: 'Denver,CO'
"data": {
"id": "null",
"type": "image",
"attributes": {
"image": {
"location": "tampa,fl",
"image_url": "example.com",
"credit": {
"source": "flickr.com",
"owner": "hulk hogan"
}
}...
POST localhost:3000/api/v1/users
- You will need to send your parameters through the body of the request, ex:
Content-Type: application/json
Accept: application/json
{
"email": "whatever@example.com",
"password": "password",
"password_confirmation": "password"
}
Example Response:
{
"data": {
"id": "1",
"type": "users",
"attributes": {
"email": "test@example.com",
"api_key": "your_api_key"
}
}
}
POST localhost:3000/api/v1/sessions
- You will need to send your parameters through the body of the request, ex:
Content-Type: application/json
Accept: application/json
{
"email": "whatever@example.com",
"password": "password",
}
Example Response:
{
"data": {
"id": "1",
"type": "users",
"attributes": {
"email": "test@example.com",
"api_key": "your_api_key"
}
}
}
POST localhost:3000/api/v1/road_trip
- You will need to send your parameters through the body of the request, ex:
Content-Type: application/json
Accept: application/json
{
"origin": "Denver,CO",
"destination": "Pueblo,CO",
"api_key": "your_api_key"
}
Example Response:
{
"data": {
"id": "null",
"type": "roadtrip",
"attributes": {
"start_city": "Denver,CO",
"end_city": "Pueblo,CO",
"travel_time": "01:44:22",
"weather_at_eta": {
"temperature": 81.3,
"conditions": "clear sky"
}
}
}
}
GET localhost:3000/api/v1/salaries
- Enter a city with a 'destination' query parameter for salaries in the tech industry, ex: 'miami' Example Response:
- Rails
- PostgreSQL
- Postman
- RSpec
- Capybara
- Fast JSON API
- Faraday
- VCR
- Webmock
- Shoulda Matchers
- Timecop
- Simplecov
- Rubocop
- Brakeman
- Redis
- Circle CI
-
Ruby 2.5.3
-
Rails 5.2.5
-
Giphy - For the weather batman gif!
{
"data": {
"id": "null",
"type": "salaries",
"attributes": {
"destination": "miami",
"forecast": {
"summary": "Broken Clouds",
"temperature": 83.12
},
"salaries": [
{
"title": "Data Scientist",
"min": "$72,490.04",
"max": "$105,784.61"
}...
Testing with RSpec
To run the full test suite you will need to run the command:
bundle exec rspec
