A Tea Subscription Service
- Rails 5.2.8
- Ruby 2.7.4
- Clone the repository
- cd into the root directory
- Install gem packages:
bundle install
- Setup the database:
rails db:{drop,create,migrate}
customer
Request:
GET /api/v1/customers/#{drake.id}/subscriptions
JSON Response Example:
{
"data": [
{
"id": "1",
"type": "subscription",
"attributes": {
"tea_id": 1,
"customer_id": 1,
"title": "Spill the Tea",
"price": 19.99,
"frequency": "every_day",
"status": "yay"
}
}
]
}
new subscription
Request:
POST /api/v1/customers/#{drake.id}/subscriptions
JSON Response Example:
{
"customer_id": 1,
"tea_id": 1,
"title": "Thai Tea",
"price": "9.99",
"frequency": "every_week",
"status": "yay"
}
update subscription
Request:
PATCH "/api/v1/customers/#{drake.id}/subscriptions/#{subscription.id}?status=boo"
JSON Response Example:
{
"data": {
"id": "2",
"type": "subscription",
"attributes": {
"tea_id": 1,
"customer_id": 1,
"title": "Thai Tea",
"price": 9.99,
"frequency": "every_week",
"status": "boo"
}
}
}