Coder Social home page Coder Social logo

spill_the_tea's Introduction

🫖 Spill the Tea 🫖

Image
via GIPHY

A Rails API for a fictional Tea Subscription Service.

Created in an 8-hour time frame for a take-home challenge; find the project spec here.

Framework

Languages

Testing

Tools

Local Setup

  1. Fork and Clone the repo
  2. Install gem packages: bundle install
  3. Set up the database: rails db:{drop,create,migrate,seed}

[Schema Design]

Screen Shot 2022-01-11 at 9 56 16 PM

-----------------------------------------------------

Endpoints

Create a tea subscription for a customer

Method URI Description
POST /api/v1/customers/:customer_id/subscriptions Creates a customer subscription in the database and returns the subscription attributes
Example:
{
    "data": {
        "id": "9",
        "type": "subscription",
        "attributes": {
            "title": "Kick In The Chest",
            "price": 24.99,
            "status": "active",
            "frequency": "biannually",
            "customer_id": 5,
            "tea_id": 5
        }
    }
}

Cancel a customer’s tea subscription

Method URI Description
PATCH /api/v1//customers/:customer_id/subscriptions/:id Cancels a customer subscription in the database and returns subscription attributes with the updated status
Example:
{
    "data": {
        "id": "8",
        "type": "subscription",
        "attributes": {
            "title": "Kick In The Chest",
            "price": 24.99,
            "status": "cancelled",
            "frequency": "biannually",
            "customer_id": 5,
            "tea_id": 5
        }
    }
}

View all of a customer’s subsciptions, of active and cancelled status

Method URI Description
GET /api/v1//customers/:customer_id/subscriptions Returns all tea subscriptions for a given customer
Example:
{
    "data": [
        {
            "id": "10",
            "type": "subscription",
            "attributes": {
                "title": "Kick In The Chest",
                "price": 24.99,
                "status": "active",
                "frequency": "monthly",
                "customer_id": 1,
                "tea_id": 5
            }
        },
        {
            "id": "13",
            "type": "subscription",
            "attributes": {
                "title": "Send Covid Packin",
                "price": 24.99,
                "status": "active",
                "frequency": "biweekly",
                "customer_id": 1,
                "tea_id": 4
            }
        },
        {
            "id": "14",
            "type": "subscription",
            "attributes": {
                "title": "Pass The Heck Out",
                "price": 24.99,
                "status": "active",
                "frequency": "biweekly",
                "customer_id": 1,
                "tea_id": 4
            }
        }
    ]
}

Project Configurations

  • Ruby Version

    $ ruby -v
    ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
  • [System Dependencies]

    $ rails -v
    Rails 5.7.2
  • Database Creation

    $ rails db:{drop,create,migrate,seed}
    Created database 'tea_time_development'
    Created database 'tea_time_test'
  • How to run the test suite:

    $ bundle exec rspec 
  • Local Deployment, for testing:

    $ rails s
    => Booting Puma
    => Rails 5.2.6 application starting in development
    => Run `rails server -h` for more startup options
    Puma starting in single mode...
    * Version 3.12.6 (ruby 2.7.2-p137), codename: Llamas in Pajamas
    * Min threads: 5, max threads: 5
    * Environment: development
    * Listening on tcp://localhost:3000
    Use Ctrl-C to stop

spill_the_tea's People

Contributors

jejones21 avatar

Watchers

 avatar

spill_the_tea's Issues

Setup

Gemfile, schema etc

Endpoint 3

See all active and cancelled subscriptions

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.