Tea Subscription is a backend API service which simulates endpoints for a tea subscription service. It was created to satisfy the requirements for a Mod 4 take-home project at the Turing School of Software and Design. Project requirements can be found here.
This application is built with Ruby on Rails and tested with RSpec. API endpoint data is returned in json.
- Clone the repo
git clone [email protected]:dlayton66/tea_subscription.git
- Install gems
bundle install
- Create database and run migrations
rails db:{create,migrate}
- Run rails server
rails server
- Create customer subscription
POST http://localhost:3000/api/v1/customers/:customer_id/subscriptions
Example params:
{
tea_id: 1,
price: 10.00,
frequency: 14
}
- Get customer subscriptions
GET http://localhost:3000/api/v1/customers/:customer_id/subscriptions
Example response:
{
"data": [
{
"id": "1",
"type": "subscription",
"attributes": {
"price": "15.0",
"frequency": 7,
"status": "cancelled",
"tea": "Black"
}
},
{
"id": "2",
"type": "subscription",
"attributes": {
"price": "8.0",
"frequency": 14,
"status": "cancelled",
"tea": "Green"
}
}
]
}
- Cancel customer subscription
PATCH http://localhost:3000/api/v1/customers/:customer_id/subscriptions/:subscription_id?status=cancelled
Run the entire spec suite
bundle exec rspec
All tests should be passing.
๐ค Drew Layton