8000 GitHub - neb417/tea_house
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

neb417/tea_house

Repository files navigation

Tea House

A Backend microservice to perform CRUD functionality for customer tea subcriptions


Explore the docs »

· Report Bug · Request Feature


About The Project

Table of Contents

  1. About The Project
  2. Built With
  3. Getting Started
  4. Prerequisites
  5. Installation
  6. Contributing
  7. APIs
  8. Contacts

Built With

Contributors Forks Issues

Ruby Ruby on Rails PostgreSQL Git Postman

Getting Started


Prerequistites

The Tea House backend is build on Rails 5.2.8.1 and Ruby 2.7.4

Installation and setup

  1. Clone the repo

    git clone git@github.com:neb417/tea_house.git
  2. Add gems In group :development, :test do

     gem 'capybara'
     gem 'factory_bot_rails'
     gem 'faker'
     gem 'pry'
     gem 'rspec-rails'
     gem 'rubocop-faker'
     gem 'rubocop-rails'
     gem 'shoulda-matchers'
     gem 'simplecov'
  3. Install Gems with $bundle install

  4. Migrate database with $rails db:{create,migrate}

  5. Seed development/test database with $rails db:seed

  6. Run test suite with $bundle exec rspec

(back to top)


Database Schema

Screen Shot 2022-12-13 at 2 05 34 PM

(back to top)


Endpoints and Testing in Postman

  • GET a customer subsctriptions by customer id
Postman:
GET http://localhost:3000/api/v1/subscriptions

query params
  key: customer_id
  value: 2
{
  "data": {
      "subscriptions": [
          {
              "id": 4,
              "price": 500,
              "status": "cancelled",
              "frequency": 14,
              "title": "Rize",
              "tea": {
                  "title": "Rize",
                  "description": "Meditation fanny pack kickstarter truffaut kinfolk aesthetic blue bottle chia.",
                  "temperature": 100,
                  "brew_time": 222
              }
          },
          {
              "id": 5,
              "price": 3008,
              "status": "active",
              "frequency": 14,
              "title": "Gaoshan",
              "tea": {
                  "title": "Gaoshan",
                  "description": "Echo chia selfies slow-carb keytar viral authentic jean shorts.",
                  "temperature": 93,
                  "brew_time": 233
              }
          },
          {
              "id": 10,
              "price": 500,
              "status": "active",
              "frequency": 7,
              "title": "English Breakfast",
              "tea": {
                  "title": "English Breakfast",
                  "description": "Street shabby chic hella butcher occupy five dollar toast mumblecore chia banjo.",
                  "temperature": 92,
                  "brew_time": 211
              }
          }
      ]
  }
}
  • CREATE a customer subscription
Postman:
POST http://localhost:3000/api/v1/subscriptions

query params
  key: customer_id, value: 2
  key: tea_id, value: 1
  key: title, value: English Breakfast
  key: frequency, value: 7
  key: price, value: 500
{
  "data": {
      "id": 10,
      "price": 500,
      "status": "active",
      "frequency": 7,
      "title": "English Breakfast",
      "tea": {
          "title": "English Breakfast",
          "description": "Street shabby chic hella butcher occupy five dollar toast mumblecore chia banjo.",
          "temperature": 92,
          "brew_time": 211
      }
  }
}
  • UPDATE a customer subscription
Postman:
PATCH http://localhost:3000/api/v1/subscriptions/4

query params
  key: id, value: 4
  key: customer_id, value: 2
  key: tea_id, value: 1
  key: frequency, value: 7
  key: price, value: 500
  status: cancelled
{
    "data": {
        "success": "Your subscriptions have been updated"
    }
}
  • CREATE a customer
Postman:
POST http://localhost:3000/api/v1/customers

query params
  key: first_name, value: Jerry
  key: last_name, value: Johnson
  key: email, value: mail@mail.com
  key: address, value: 123 South St, Town, ST, 12345
{
    "data": {
        "id": 6,
        "first_name": "Jerry",
        "last_name": "Johnson",
        "email": "mail@mail.com",
        "address": "123 South St, Town, ST, 12345"
    }
}


Contact

Contributor:

Benjamin Randolph: GitHub || LinkedIn
Benjamin Randolph GitHub

Project Link: Tea House

(back to top)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0