Shawnl93 / spill_the_tea

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spill The Tea

Spill The Tea
Table of Contents

Project Overview

A Tea Subscription Service

Built With

  • Rails 5.2.8
  • Ruby 2.7.4

Setup

  1. Clone the repository
  2. cd into the root directory
  3. Install gem packages: bundle install
  4. Setup the database: rails db:{drop,create,migrate}

APIs

customer

Request:

GET /api/v1/customers/#{drake.id}/subscriptions

JSON Response Example:

{
    "data": [
        {
            "id": "1",
            "type": "subscription",
            "attributes": {
                "tea_id": 1,
                "customer_id": 1,
                "title": "Spill the Tea",
                "price": 19.99,
                "frequency": "every_day",
                "status": "yay"
            }
        }
    ]
}
new subscription

Request:

POST /api/v1/customers/#{drake.id}/subscriptions

JSON Response Example:

{
    "customer_id": 1,
    "tea_id": 1,
    "title": "Thai Tea",
    "price": "9.99",
    "frequency": "every_week",
    "status": "yay"
}
update subscription

Request:

PATCH "/api/v1/customers/#{drake.id}/subscriptions/#{subscription.id}?status=boo"

JSON Response Example:

{
    "data": {
        "id": "2",
        "type": "subscription",
        "attributes": {
            "tea_id": 1,
            "customer_id": 1,
            "title": "Thai Tea",
            "price": 9.99,
            "frequency": "every_week",
            "status": "boo"
        }
    }
}

About


Languages

Language:Ruby 99.1%Language:HTML 0.9%