Coder Social home page Coder Social logo

rails-engine's Introduction

Rails Engine

Mod 3 Solo Project: Building a Rails API

Project Description

You are working for a company developing an E-Commerce Application. Your team is working in a service-oriented architecture, meaning the front and back ends of this application are separate and communicate via APIs. Your job is to expose the data that powers the site through an API that the front end will consume.

Schema

Setup Instructions

To get a local copy up and running follow these simple steps.

  1. Clone the repo
    git clone https://github.com/elyhess/rails-engine
    
  2. Install dependencies
    bundle install
    
  3. DB creation/migration
    rails db:create
    rails db:migrate
    rails db:seed
    
  4. Run tests and view test coverage
    bundle exec rspec
    open coverage/index.html
    
  5. Run server and navigate to http://localhost:3000/
    rails s
    

rails-engine's People

Contributors

elyhess avatar

Watchers

 avatar

rails-engine's Issues

delete an item

http://localhost:3000/api/v1/items/{{item_id}}

  • destroy the corresponding record (if found) and any associated data

  • destroy any invoice if this was the only item on an invoice

  • NOT return any JSON body at all, and should return a 204 HTTP status code

  • NOT utilize a Serializer (Rails will handle sending a 204 on its own if you just .destroy the object)

get all items, a maximum of 20 at a time

http://localhost:3000/api/v1/items

GET /api/v1/items?per_page=50&page=2
GET /api/v1/merchants?per_page=50&page=2

  • This should fetch items 51 through 100, since we’re returning 50 per “page”, and we want “page 2” of data.

  • If a user tries to fetch a page for which there is no data, then data should report an empty array.

create an item

http://localhost:3000/api/v1/items

accept the following JSON body with only the following fields:

  • name

  • description

  • unit_price

  • merchant_id

  • (Note that the unit price is to be sent as a numeric value, not a string.)

  • return an error if any attribute is missing

  • should ignore any attributes sent by the user which are not allowed

total revenue generated in the whole system over a start/end date range

GET /api/v1/revenue?start_date=<start_date>&end_date=<end_date>

GET /api/v1/revenue?start=2012-03-09&end=2012-03-24

  • Assume your users will only send dates in the format YYYY-MM-DD. Revenue must be counted for any invoices on the end_date as well.

  • An error should be returned if either/both the start date or end date are not provided.

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.