This is an API for a membership platform.
- Clone the repository
- cd into the directory
plans-api
and runbundle
to install the dependencies - Run
rails db:migrate
- Run
rails s
to start the API
-
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 |
The API uses token-based authorization. The API expects the token to be passed in to the Authorization header with every request.
- Run
rspec
to run the tests