Giter Site home page Giter Site logo

tea_subscription's Introduction

Tea Subscription

Table of Contents

Description

Tea Subscription is a backend API service which simulates endpoints for a tea subscription service. It was created to satisfy the requirements for a Mod 4 take-home project at the Turing School of Software and Design. Project requirements can be found here.

Technical Details

This application is built with Ruby on Rails and tested with RSpec. API endpoint data is returned in json.

Getting Started

Local Installation

  1. Clone the repo
git clone [email protected]:dlayton66/tea_subscription.git
  1. Install gems
bundle install
  1. Create database and run migrations
rails db:{create,migrate}
  1. Run rails server
rails server
  1. Call the endpoints from your favorite API platform (e.g. Postman)

Endpoints

  1. Create customer subscription
POST http://localhost:3000/api/v1/customers/:customer_id/subscriptions

Example params:
{
  tea_id: 1,
  price: 10.00,
  frequency: 14
}
  1. Get customer subscriptions
GET http://localhost:3000/api/v1/customers/:customer_id/subscriptions

Example response:
{
    "data": [
        {
            "id": "1",
            "type": "subscription",
            "attributes": {
                "price": "15.0",
                "frequency": 7,
                "status": "cancelled",
                "tea": "Black"
            }
        },
        {
            "id": "2",
            "type": "subscription",
            "attributes": {
                "price": "8.0",
                "frequency": 14,
                "status": "cancelled",
                "tea": "Green"
            }
        }
    ]
}
  1. Cancel customer subscription
PATCH http://localhost:3000/api/v1/customers/:customer_id/subscriptions/:subscription_id?status=cancelled

RSpec Suite

Run the entire spec suite

bundle exec rspec

All tests should be passing.

Schema

Screenshot 2023-04-13 at 9 14 20 PM

Authors & Acknowledgments

๐Ÿ‘ค Drew Layton

tea_subscription's People

Contributors

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