briankabiro / plans-api

A membership API built with Rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plans API

This is an API for a membership platform.

Setup

  1. Clone the repository
  2. cd into the directory plans-api and run bundle to install the dependencies
  3. Run rails db:migrate
  4. Run rails s to start the API

Project outline

  • The API currently has two resources: plans and members.

  • The members_controller and plans_controller hold the code for handling requests.

Endpoint Parameters Response Description
GET /plans [{"name": string, "start_date": "string", "end_date": "string"},{}..] get all plans
POST /plans Required: name

{
"name": string, "start_date": "string", "end_date": "string"
}
{"name": string, "start_date": "string", "end_date": "string"} create a plan
GET /plans/:plan_id/members plan_id: integer [{"name": string, "start_date": "string", "end_date": "string"},...] get members belonging to a plan
POST /members Required: first_name, last_name, date_of_birth

{
"first_name": "string",
"last_name: "string", "date_of_birth": "string", plan_id:"integer"
}
{
"first_name": "string", "last_name": "string", "date_of_birth": "string", plan_id: "integer"
}
create a member
PUT /members/:id { plan_id: integer } {
"first_name": "string", "last_name:: "string", "date_of_birth:: "string", plan_id: "integer"
}
assign a member to a plan

Authorization

The API uses token-based authorization. The API expects the token to be passed in to the Authorization header with every request.

Testing

  • Run rspec to run the tests

About

A membership API built with Rails


Languages

Language:Ruby 99.4%Language:HTML 0.6%