- The purpose of this api is to create api calls for a frontend to consume
- The three endpoints subscribe a customer, cancel a customers subscription, and list all of a customers subscriptions
- A strong understanding of Rails
- Ability to create restful routes
- Demonstration of well-organized code, following OOP
- Test Driven Development
- Clear documentation
$ git clone git@github.com:ross-ian28/tea_service.git
$ cd tea_service
$ rails db:{:create,:migrate}
$ bundle install
$ rails s
get /api/v1/subscribe
body:
{
title: "Silver",
price: 2.00,
status: "Active",
frequency: "Monthly",
customer_id: 1,
tea_id: 1
}
{
"data": {
"id": 4,
"type": "subscription",
"attributes": {
"title": "Gold",
"price": 2,
"status": "Active",
"frequency": "Monthly",
"customer_id": 1,
"tea_id": 1
}
}
}
patch /api/v1/subscribe/cancel
body:
{
"sub_id": 1,
"status": "Canceled"
}
{
"data": {
"id": 1,
"type": "subscription",
"attributes": {
"title": "Silver",
"price": 2,
"status": "Canceled",
"frequency": "Monthly",
"customer_id": 1,
"tea_id": 1
}
}
}
get /api/v1/customer/subscriptions
body:
{ "customer_id": 1 }
{
"data": [
{
"id": 1,
"title": "Silver",
"price": 2,
"status": "Active",
"frequency": "Monthly",
"customer_id": 1,
"tea_id": 1
},
{
"id": 2,
"title": "Platinum",
"price": 5,
"status": "Canceled",
"frequency": "Monthly",
"customer_id": 1,
"tea_id": 2
},
{
"id": 3,
"title": "Gold",
"price": 2,
"status": "Active",
"frequency": "Monthly",
"customer_id": 1,
"tea_id": 1
}
]
}