Take-Home Back End Prompt Tea Subscription Service You will create a Rails API for a Tea Subscription Service.
Requirements: At a minimum, you must create:
An endpoint to subscribe a customer to a tea subscription An endpoint to cancel a customer’s tea subscription An endpoint to see all of a customer’s subscriptions (active and cancelled) Beyond the base requirements, include any additional endpoints you’d like, but be mindful of your time. You don’t need to go overboard, consider what might be necessary to achieve MVP so that this API is easy to understand and consume by a Frontend Developer.
Things we’ll be looking for: A strong understanding of Rails Ability to create restful routes Demonstration of well-organized code, following OOP Test Driven Development Clear documentation Try to limit your total time to approximately 8 hours on this project. Prioritize what is important to completing MVP and demonstrating your capabilities as a developer. If you are looking for a stretch option, you can consume this API for tea information: Tea API
Follow the instructions listed below to get the application up and running.
- Clone the repo
git clone [email protected]:ozzman84/tea_subscription.git
- Run bundle
bundle install
- Run migrations
rails db:{create,migrate}
POST http://localhost:3000/api/v1/customer/subscriptions
QUERIES
All Customers
-
All Customers Query
{ customer_id: 2 }
-
JSON Return Payload
{ "data": { "id": 1, "type": "subscription", "attributes": { "title": "Eary Grey", "price": 5.99, "status": "active", "frequency": "weekly" }, "relationships": { "id": "1", "type": "customer", "attributes": { "name": "Customer A" }, "id": "1", "id": "tea", "attributes": { "name": "Earl Grey" } }, "id": 2, "type": "subscription", "attributes": { "title": "Eary Grey", "price": 5.99, "status": "active", "frequency": "weekly" }, "relationships": { "id": "1", "type": "customer", "attributes": { "name": "Customer A" }, "id": "1", "id": "tea", "attributes": { "name": "Earl Grey" } } } }
CREATE
- Create Customer Mutation
{
customer_id: 2,
tea_id: 1,
title: 'Test Name of Tea',
price: 5.99,
status: 'active',
frequency: 'weekly'
}
- JSON Return Payload
{
"data": {
"id": 2,
"type": "subscription",
"attributes": {
"title": "Eary Grey",
"price": 5.99,
"status": "active",
"frequency": "weekly"
},
"relationships": {
"id": "1",
"type": "customer",
"attributes": {
"name": "Customer A"
},
"id": "1",
"id": "tea",
"attributes": {
"name": "Earl Grey"
}
}
}
}
UPDATE
- Update Location Query
{
subscription_id: 1,
status: "cancelled"
}
- JSON Return Payload
{
"data": {
"id": 2,
"type": "subscription",
"attributes": {
"title": "Eary Grey",
"price": 5.99,
"status": "active",
"frequency": "weekly"
},
"relationships": {
"id": "1",
"type": "customer",
"attributes": {
"name": "Customer A"
},
"id": "1",
"id": "tea",
"attributes": {
"name": "Earl Grey"
}
}
}
}
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Back-end Team | ||
---|---|---|
Ozzie Osmonson | link | link |