Giter Site home page Giter Site logo

take_home_challenge_be's Introduction

Take Home Challenge (Back end Repo)

About This Project

Requirements:

At a minimum, you must create:

An endpoint to subscribe a customer to a tea subscription An endpoint to cancel a customer’s tea subscription An endpoint to see all of a customer’s subsciptions (active and cancelled) Beyond the base requirements, include any additional endpoints you’d like, but be mindful of your time. You don’t need to go overboard, consider what might be necessary to achieve MVP so that this API is easy to understand and consume by a Frontend Developer.

Things we'll be looking for:

  • A strong understanding of Rails
  • Ability to create restful routes
  • Demonstration of well-organized code, following OOP
  • Test Driven Development
  • Clear documentation Try to limit your total time to approximately 8 hours on this project. Prioritize what is important to completing MVP and demonstrating your capabilities as a developer. If you are looking for a stretch option, you can consume this API for tea product information: Spoontacular API

Purpose

To show a strong understanding with Ruby on Rails.

Built With

Ruby
Postgresql
Rails
Visual Studio Code
Postman Badge

Running On

  • Rails 7.0.8
  • Ruby 3.2.2

Getting Started

To get a local copy, follow these simple instructions

Installation

  1. Fork the Project
  2. Clone the repo
git clone [email protected]:jpnelson85/take_home_challenge_be.git
  1. Install the gems
bundle install
  1. Create the database
rails db:{create,migrate}
  1. Create your Feature Branch
git checkout -b feature/AmazingFeature
  1. Commit your Changes
git commit -m 'Add some AmazingFeature' 
  1. Push to the Branch
git push origin feature/AmazingFeature
  1. Open a Pull Request

Endpoints Used

POST Request {title: String, price_dollars: Float, frequency_by_months: Integer, customer_id: Integer, tea_id Integer, status: String}
Response {
    "data": {
        "id": "910",
        "type": "subscription",
        "attributes": {
            "title": "Green Tea_john_doe5",
            "price_dollars": 10.0,
            "frequency_by_months": 1,
            "status": "active",
            "tea": 827,
            "customer": 797
        }
    }
}
PATCH Request {email: String, title: String, status: String}
Response {
    "data": {
        "id": "910",
        "type": "subscription",
        "attributes": {
            "title": "Green Tea_john_doe5",
            "price_dollars": 10.0,
            "frequency_by_months": 1,
            "status": "active",
            "tea": 827,
            "customer": 797
        }
    }
}
GET Request {email: String}
{
    "data": [
        {
            "id": "694",
            "type": "subscription",
            "attributes": {
                "title": "Green Tea_john_doe",
                "price_dollars": 10.0,
                "frequency_by_months": 1,
                "status": "active",
                "tea": "Green Tea",
                "customer": "[email protected]"
            }
        },
        {
            "id": "695",
            "type": "subscription",
            "attributes": {
                "title": "\"Green Tea_john_doe2\"",
                "price_dollars": 10.0,
                "frequency_by_months": 1,
                "status": "active",
                "tea": "Green Tea",
                "customer": "[email protected]"
            }
        },
        {
            "id": "696",
            "type": "subscription",
            "attributes": {
                "title": "\"Green Tea_john_doe3\"",
                "price_dollars": 10.0,
                "frequency_by_months": 1,
                "status": "active",
                "tea": "Green Tea",
                "customer": "[email protected]"
            }
        },
        {
            "id": "909",
            "type": "subscription",
            "attributes": {
                "title": "\"Green Tea_john_doe4\"",
                "price_dollars": 10.0,
                "frequency_by_months": 1,
                "status": "active",
                "tea": "Green Tea",
                "customer": "[email protected]"
            }
        },
        {
            "id": "910",
            "type": "subscription",
            "attributes": {
                "title": "Green Tea_john_doe5",
                "price_dollars": 10.0,
                "frequency_by_months": 1,
                "status": "active",
                "tea": "Green Tea",
                "customer": "[email protected]"
            }
        }
    ]
}

Schema

create_table "customers", force: :cascade do |t|
    t.string "first_name"
    t.string "last_name"
    t.string "email"
    t.string "address"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "subscriptions", force: :cascade do |t|
    t.string "title"
    t.float "price_dollars"
    t.integer "frequency_by_months"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.bigint "customer_id", null: false
    t.bigint "tea_id", null: false
    t.index ["customer_id"], name: "index_subscriptions_on_customer_id"
    t.index ["tea_id"], name: "index_subscriptions_on_tea_id"
  end

  create_table "teas", force: :cascade do |t|
    t.string "title"
    t.string "description"
    t.integer "temperature_f"
    t.integer "brew_time_min"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  add_foreign_key "subscriptions", "customers"
  add_foreign_key "subscriptions", "teas"

Routes

namespace :api do
  namespace :v1 do
    post '/subscribe', to: 'subscription#new'
    patch '/subscribe', to: 'subscription#update'
    get '/subscribe', to: 'subscription#index'
  end
end

Contributing

[email protected]:jpnelson85/take_home_challenge_be.git

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  • Jeff Nelson GitHub LinkedIn

take_home_challenge_be's People

Contributors

jpnelson85 avatar

Watchers

 avatar

take_home_challenge_be's Issues

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.