Giter Club home page Giter Club logo

mod4_takehome's Introduction

Tea Subscription API

Database Schema:

https://dbdesigner.page.link/rm8imwDVw2Z4D6AK8

JSON Contract

POST /api/v1/subscribe This route will create a new subscription for a customer and tea Payload Request:

{
  "tea_name": "Oolong",
  "email": "[email protected]",
  "monthly_fee": 12.99,
  "frequency": "monthly"
}

Payload Response:

{
    "data": {
        "id": "2",
        "type": "subscription",
        "attributes": {
            "subscription_id": "8232b9c27c401476a1a35bd6a02f0685",
            "monthly_fee": 12.99,
            "status": "active",
            "frequency": "monthly",
            "tea": "Oolong",
            "customer": "[email protected]"
        }
    }
}

DELETE /api/v1/subscribe This route will cancel a subscription for a customer and tea

Payload Request:

{
  "subscription_id": "8232b9c27c401476a1a35bd6a02f0685"
}

Payload Response:

{
    "data": {
        "id": "2",
        "type": "subscription",
        "attributes": {
            "subscription_id": "8232b9c27c401476a1a35bd6a02f0685",
            "monthly_fee": 12.99,
            "status": "cancelled",
            "frequency": "monthly",
            "tea": "Oolong",
            "customer": "[email protected]"
        }
    }
}

POST /api/v1/subscriptions This route will give you all the subscriptions a customer currently has

Payload Request:

{
  "email": "[email protected]"
}

Payload Response:

{
    "data": [
        {
            "id": "1",
            "type": "subscription",
            "attributes": {
                "subscription_id": "95704b22c66b55b1648d61a81802b07b",
                "monthly_fee": 12.99,
                "status": "cancelled",
                "frequency": "monthly",
                "tea": "Oolong",
                "customer": "[email protected]"
            }
        }
    ]
}

Ruby and Rails Version

ruby 3.2.2 rails 7.0.7

Gems can be found in the Gemfile

Setup

install ruby 3.2.2 instructions can be found at https://www.ruby-lang.org/en/documentation/installation/

install bundler, bundler can be found at https://bundler.io/

after installing bundler run command bundle in terimal while in the root directory of this project

Go to root directory of this project and run rails s to boot up a virtual server that you can make requests to

Testing

To run tests first go through setup then run bundle exec rspec in terminal while in the root directory

mod4_takehome's People

Contributors

boomclear avatar

Watchers

 avatar

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.