Code Monkey home page Code Monkey logo

checkmeplease's Introduction

Med Card REST API

Created By Ben Ghalami

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!

Schema

Endpoints

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

Initial Setup

  1. Clone the repository into a directory of your choosing:
git clone [email protected]:GhostGroup/api-test-beng.git
  1. Navigate into the new directory.
  2. Merge my Dev branch
  git pull origin dev
  1. Install the dependencies:
bundle install
  1. Run the following command to create, migrate, and seed the database
rake db:create db:migrate db:seed

Running the Test Suite

  1. After Initial Setup run
rspec
  1. To see test coverage run
open coverage/index.html

Running the Server Locally

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.

Built With

Tech

Gems

Organic

checkmeplease's People

Contributors

bghalami avatar dzunk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.