Giter VIP home page Giter VIP logo

tea_subscription's Introduction

Tea Subscription Service

This is a Rails API for a tea subscription Service. It has 3 endpoints to 1. subscribe a customer to a tea subscription, 2. cancel a customer's tea subscription, and 3. view all of a customer's subscriptions.

Stack

  • Ruby on Rails, RSpec, PostgreSQL

Readme Content

Local Setup

  • Versions
    • Rails 5.2.6
    • Ruby 2.7.2
  • Fork and clone this repository
  • cd in your local repo version and run the following commands
    • To install gems:
      • bundle
    • To setup database:
      • rails db:create
      • rails db:migrate
      • rails db:seed
  • Run your own development server:

Schema Diagram

Screen Shot 2022-02-24 at 5 27 36 PM

API Endpoints

  • **View all subscription for a customer **:

    • Request: GET '/api/v1/customers/:id/subscriptions'
    • Response:
         {
             "data": [
                 {
                     "id": "1",
                     "type": "subscriptions",
                     "attributes": {
                         "title": "Subscription1",
                         "price_per_month": null,
                         "status": "active",
                         "frequency": "biweekly",
                         "customer_id": 1,
                         "tea_id": 1
                     }
                 },
                 {
                     "id": "2",
                     "type": "subscriptions",
                     "attributes": {
                         "title": "Subscription2",
                         "price_per_month": null,
                         "status": "active",
                         "frequency": "bimonthly",
                         "customer_id": 1,
                         "tea_id": 6
                     }
                 }
             ]
         }
    
  • Create a new subscription for a customer:

    • Request: POST '/api/v1/customers/1/subscriptions'
    • Request Parameter as JSON: title, frequency and tea_id are required.
           {
             "title": "Sencha Monthly",
             "frequency": "monthly",
             "tea_id": 1
            }
    
    • Response:
           {
             "data": {
                 "id": "12",
                 "type": "subscriptions",
                 "attributes": {
                     "title": "Sencha Monthly",
                     "price_per_month": "20.0",
                     "status": "active",
                     "frequency": "monthly",
                     "customer_id": 1,
                     "tea_id": 1
                 }
               }
             }
    
  • Delete a subscription:

    • Request: DELETE '/api/v1/subscriptions/:id'
    • Response:
      {
        "message": "The subscription is successfully deleted"
      }
    

Contributor

tea_subscription's People

Contributors

haewonito 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.