Created by: Mack Halliday
SweaterWeather is an API application with endpoints to return local weather, a city background image, and roadtrip information. The application also can create and login a user with a post request.
Application address
https://sweater-weather-halliday.herokuapp.com/
Returns current weather and forecast for location
GET /api/v1/forecast?location=denver,co
location
: desired city location with state or country
Returns large image with orientation as landscape
GET /api/v1/backgrounds?location=denver,co
location
: Desired city location with state or country
Creates a user with valid emails and password matching password confirmation
If successful, will return user's API key and 201 status
POST /api/v1/users
{
"email": "whatever@example.com",
"password": "password",
"password_confirmation": "password"
}
email
: Must be valid email not already used by another user
password
: Desired password
password_confirmation
: Must match password
Logins in user with correct password
If successful, will return user's API key and 201 status
POST /api/v1/sessions
{
"email": "whatever@example.com",
"password": "password",
}
email
: Must match email used to create account
password
: Must match password used to create account
Returns details for road trip including travel time and weather at destination
Must include valid API key
If successful, will return details for road trip and status 201
POST /api/v1/road_trip
{
origin: "Denver,CO",
destination: "Pueblo,CO",
api_key: "YOUR_API_KEY"
}
origin
: Starting city with state or country
destination
: Ending city with state or country
api_key
: Valid API key given to user when account created
Clone down the repo
$ git clone
Install the gem packages
$ bundle install
Set up the database
$ rake db:create
$ rake db:migrate
Add the following API Key to your application.yml
file
google_geocode: YOUR_GOOGLE_API_KEY
dark_sky: YOUR_DARK_SKY_API_KEY
antipode: oscar_the_grouch
unsplash_access_key: YOUR_UNSPLASH_API_KEY
Where to get API Keys
Run the test suite:
$ rspec
Run application locally:
$ rails s
- Visit
http://localhost:3000/
in Chrome browser - Add desired endpoint to localhost address
- Ruby 2.4.1
- Rails 5.2.0