Tea Time is an API built with Ruby on Rails. It is the final project in Mod 4 of Turing School. It is a take home challenge for interview practice and is to be completed in 5-8 hours.
This app follows RESTful API conventions.
The learning goals of this project were to
- show a strong understanding of rails
- ability to create restful routes
- demonstration of well organized code that follows OOP
- TDD
- clear documentation
- fork and clone repo
- install gem packages
bundle install
- run
rails db:{create,migrate,seed}
- check schema
![Alt text](schema.jpg) ## Endpoints ``` - POST 'api/v1/customer_subscriptions?customer_id=1&subscription_id=1' - PATCH 'api/v1/customer_subscriptions?customer_id=1&subscription_id=1' - GET 'api/v1/customers?id=1' ``` ## JSON Responses (in order of the endpoints) ### POST Status 200: ``` { "message": "Subscription created" } ``` Status 400: ``` { "message": "Subscription already active" } ``` Status 400: ``` { "message": "Subscription not created" } ``` ### GET Status 200: ``` { "data": { "id": "1", "type": "customer", "attributes": { "name": "Barry Whyte", "email": "[email protected]", "password": "test123", "active_subscriptions": [ { "id": 1, "title": "Crack", "price": 10.99, "frequency": 1 }, { "id": 3, "title": "English", "price": 30.99, "frequency": 3 } ], "inactive_subscriptions": [ { "id": 2, "title": "Chill", "price": 20.99, "frequency": 2 } ] } } } ``` Status 400: ``` { "error": "Customer not found" } ``` ### Versions - Ruby 3.2.2 - Rails 7.0.8
- Crow Rising