Learning Goals:
- Expose an API created using multiple APIs that requires authentication
- Expose an API for CRUD functionality
An API key can be generated by creating a POST request that includes login information
GET /api/v1/forecast
required params: "location"
GET /api/v1/background
required params: "location"
POST /api/v1/users
body must include: "email", "password", and "password_confirmation"
POST /api/v1/sessions
body must include: "email" and "password"
POST /api/v1/road_trip
body must include: "origin", "destination", and "api_key"
GET /api/v1/forecast?location=denver,co
Content-Type: application/json
Accept: application/json
GET /api/v1/backgrounds?location=denver,co
Content-Type: application/json
Accept: application/json
POST /api/v1/users
Content-Type: application/json
Accept: application/json
{
"email": "[email protected]",
"password": "password",
"password_confirmation": "password"
}
POST /api/v1/sessions
Content-Type: application/json
Accept: application/json
{
"email": "[email protected]",
"password": "password"
}
POST /api/v1/road_trip
Content-Type: application/json
Accept: application/json
body:
{
"origin": "Denver,CO",
"destination": "Pueblo,CO",
"api_key": "234ve3xxxx"
}
- Ruby 2.7.2
- Rails 5.2.6
Sweater Weather use the REST design structure.
- PostgreSQL
Users
model- Facade, Service, PORO framework for additional objects
- rspec-rails
- From command line run
bundle exec rspec
git clone
cd sw_final
bundle install
rails db:create
rails db:migrate
bundle exec rspec
rails server