This is an API with the ability to Create, View, Delete, and Edit Users, as well as Create, View, Delete, and Edit those Users Med Cards and State IDs
See the app in action at HERE!
GET '/api/v1/users'
- See all Users
POST '/api/v1/users'
- Create a new User
- Takes the following as JSON in the BODY
- NONE of the fields can be empty
- {
"name": {VARCHAR},
"email_address": {VARCHAR},
"date_of_birth": {YYYY-MM-DD}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
GET '/api/v1/users/:id'
- Show a single User with State ID and Medical Recommendation
- EXAMPLE:
{
id: 1,
name: "Ben",
email_address: "[email protected]",
date_of_birth: "1992-08-05",
state_id: {
id_number: 4,
state: "Kansas",
expiration_date: "1995-08-05(EXPIRED)",
path_to_image: "/file/file/file/file.jpg"
},
medical_recommendation: {
recommendation_number: 4,
issuer: "A Doctor",
state: "Kansas",
expiration_date: "1995-08-05(EXPIRED)",
path_to_image: "/file/file/file/file.jpg"
}
}
PUT '/api/v1/users:id'
- Update an existing User
- Takes any combination of the following JSON
- {
"name": {VARCHAR},
"email_address": {VARCHAR},
"date_of_birth": {YYYY-MM-DD}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
DELETE '/api/v1/users:id'
- Permanantly deletes a User and associated State ID and
Medical Recommendation from the database
GET '/api/v1/users/:user_id/state_id'
- View a Users State ID info
- EXAMPLE:
{
id_number: 4,
state: "Kansas",
expiration_date: "1995-08-05(EXPIRED)",
path_to_image: "/file/file/file/file.jpg"
}
POST '/api/v1/users/:user_id/state_id'
- Create a State ID for a User
- Takes the following as JSON in the BODY
- NONE of the fields can be empty
- {
"id_number": {INTEGER},
"state": {VARCHAR},
"expiration_date": {YYYY-MM-DD},
"path_to_image": {VARCHAR}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
PUT '/api/v1/users/:user_id/state_id'
- Edit an existing User State ID
- Takes any combination of the following JSON
- {
"id_number": {INTEGER},
"state": {VARCHAR},
"expiration_date": {YYYY-MM-DD},
"path_to_image": {VARCHAR}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
DELETE '/api/v1/users/:user_id/state_id'
- Permanently deletes a Users State ID
GET '/api/v1/users/:user_id/medical_recommendation'
- View a Users Medical Recommendation
- EXAMPLE:
{
recommendation_number: 4,
issuer: "A Doctor",
state: "Kansas",
expiration_date: "1995-08-05(EXPIRED)",
path_to_image: "/file/file/file/file.jpg"
}
POST '/api/v1/users/:user_id/medical_recommendation'
- Create a Medical Recommendation for a User
- Takes the following as JSON in the BODY
- NONE of the fields can be empty
- {
recommendation_number: {INTEGER},
issuer: {VARCHAR},
state: {VARCHAR},
expiration_date: {YYYY-MM-DD},
path_to_image: {VARCHAR}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
PUT '/api/v1/users/:user_id/medical_recommendation'
- Edit an existing User Medical Recommendation
- Takes any combination of the following JSON
- {
recommendation_number: {INTEGER},
issuer: {VARCHAR},
state: {VARCHAR},
expiration_date: {YYYY-MM-DD},
path_to_image: {VARCHAR}
}
- MUST include HTTP header:
`Content-Type` with value `application/json`
DELETE '/api/v1/users/:user_id/medical_recommendation'
- Permanently deletes a Users Medical Recommendation
from the DataBase
- Clone the repository into a directory of your choosing:
git clone [email protected]:GhostGroup/api-test-beng.git
- Navigate into the new directory.
- Merge my Dev branch
git pull origin dev
- Install the dependencies:
bundle install
- Run the following command to create, migrate, and seed the database
rake db:create db:migrate db:seed
- After
Initial Setup
run
rspec
- To see test coverage run
open coverage/index.html
To see your code in action locally, you need to fire up a development server. From the root of the project
use the command:
rails server
Once the server is running, visit in your browser, or with PostMan:
-
http://localhost:3000/
to run your application. -
The DB should be populated with 3 test Users for you to play around with
-
To quit the server simply press Ctrl + C to shut it down.
- Rails 5.1.7
- Ruby 2.4.1
- PostgreSQL
- And last but CERTAINLY not least, Stack Overflow