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 subsciptions (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.
- 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 product information: Spoontacular API
To show a strong understanding with Ruby on Rails.
- Rails 7.0.8
- Ruby 3.2.2
To get a local copy, follow these simple instructions
- Fork the Project
- Clone the repo
git clone [email protected]:jpnelson85/take_home_challenge_be.git
- Install the gems
bundle install
- Create the database
rails db:{create,migrate}
- 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
POST Request {title: String, price_dollars: Float, frequency_by_months: Integer, customer_id: Integer, tea_id Integer, status: String}
Response {
"data": {
"id": "910",
"type": "subscription",
"attributes": {
"title": "Green Tea_john_doe5",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": 827,
"customer": 797
}
}
}
PATCH Request {email: String, title: String, status: String}
Response {
"data": {
"id": "910",
"type": "subscription",
"attributes": {
"title": "Green Tea_john_doe5",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": 827,
"customer": 797
}
}
}
GET Request {email: String}
{
"data": [
{
"id": "694",
"type": "subscription",
"attributes": {
"title": "Green Tea_john_doe",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": "Green Tea",
"customer": "[email protected]"
}
},
{
"id": "695",
"type": "subscription",
"attributes": {
"title": "\"Green Tea_john_doe2\"",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": "Green Tea",
"customer": "[email protected]"
}
},
{
"id": "696",
"type": "subscription",
"attributes": {
"title": "\"Green Tea_john_doe3\"",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": "Green Tea",
"customer": "[email protected]"
}
},
{
"id": "909",
"type": "subscription",
"attributes": {
"title": "\"Green Tea_john_doe4\"",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": "Green Tea",
"customer": "[email protected]"
}
},
{
"id": "910",
"type": "subscription",
"attributes": {
"title": "Green Tea_john_doe5",
"price_dollars": 10.0,
"frequency_by_months": 1,
"status": "active",
"tea": "Green Tea",
"customer": "[email protected]"
}
}
]
}
create_table "customers", force: :cascade do |t|
t.string "first_name"
t.string "last_name"
t.string "email"
t.string "address"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "subscriptions", force: :cascade do |t|
t.string "title"
t.float "price_dollars"
t.integer "frequency_by_months"
t.integer "status", default: 0
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "customer_id", null: false
t.bigint "tea_id", null: false
t.index ["customer_id"], name: "index_subscriptions_on_customer_id"
t.index ["tea_id"], name: "index_subscriptions_on_tea_id"
end
create_table "teas", force: :cascade do |t|
t.string "title"
t.string "description"
t.integer "temperature_f"
t.integer "brew_time_min"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_foreign_key "subscriptions", "customers"
add_foreign_key "subscriptions", "teas"
namespace :api do
namespace :v1 do
post '/subscribe', to: 'subscription#new'
patch '/subscribe', to: 'subscription#update'
get '/subscribe', to: 'subscription#index'
end
end
[email protected]:jpnelson85/take_home_challenge_be.git
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.