An application that handles tea subscriptions for a ficticious company
This application is completed following the mod 4 practice take-home guidelines for the Turing School of Software and Design which can be found here.
This application was written in Ruby 2.7.2 with Ruby on Rails version 5.2.6.
- Fork and Clone the repo
- Install gem packages:
bundle install
- Set-up Figaro:
bundle exec figaro install
and add API keys (listed below) to config/application.yml - Setup the database:
rails db:{drop,create,migrate}
- Start local server to hit endpoints:
rails server
All requests should be sent with the following headers:
Content-Type: application/json
Accept: application/json
Returns all of the customers subscriptions
Example Resonse: Status: 200
{
"data": [
{
"id": 1,
"title": "my subscription",
"price": 3440,
"status": "active",
"frequency": "weekly",
"teas": [
{
"id": 1,
"title": "Earl Grey",
"description": "black tea",
"temperature": 90,
"brew_time": 180
},
{
"id": 3,
"title": "Camomile",
"description": "herbal tea",
"temperature": 70,
"brew_time": 300
}
]
}
]
}
Creates a customer subscription
Example request body:
{
"frequency": "weekly",
"title": "my subscription",
"teas": [
{
"id": 1,
"price": 520,
"quantity": 2
},
{
"id": 3,
"price": 600,
"quantity": 4
}
]
}
Example response:
Status: 201
{
"data": {
"id": 1,
"title": "my subscription",
"price": 3440,
"status": "active",
"frequency": "weekly",
"teas": [
{
"id": 1,
"title": "Earl Grey",
"description": "black tea",
"temperature": 90,
"brew_time": 180
},
{
"id": 3,
"title": "Camomile",
"description": "green tea",
"temperature": 70,
"brew_time": 300
}
]
}
}
Deletes the subscription. Returns 204 no content on success