Skip to content

tsnieuwen/rails-engine

Repository files navigation

Rails Engine

This is the spec for the rails engine used for Turing's Backend Module 3.

Rails Engine is a project that exposes the data that powers a mock E-Commerce Application via APIs. In total, there are 14 endpoints exposed for front end developers to consume.

Table of Contents

Authors

Getting Started

  • Fork a copy of the repo to your Github account
  • Clone the forked repo onto your local computer
  • Run bundle
  • Run rails db:{drop,create,migrate,seed}
  • Run rails s to fire up your localhost:3000
    • This project is not currently hosted or deployed. As such, consumption and review of the API endpoints take place only in the local environment

Endpoints

  1. http://localhost:3000/api/v1/merchants

    • GET Get all merchants: Returns all of the current merchant records in the database. Results are defaulted to return 20 merchants per page, however, the user can specify how many merchants they would like returned on each page by manipulating the per_page query param.
  2. http://localhost:3000/api/v1/merchants/{{merchant_id}}

    • GET Get one merchant: Returns an individual merchant record, based on the merchant's database id.
  3. http://localhost:3000/api/v1/merchants/{{merchant_id}}/items

    • GET Get a merchant's items: Returns all items which belong to an individual merchant.
  4. http://localhost:3000/api/v1/items

    • GET Get all items: Returns all of the current item records in the database. Results are defaulted to return 20 items per page, however, the user can specify how many items they would like returned on each page by manipulating the per_page query param.
  5. http://localhost:3000/api/v1/items/{{item_id}}

    • GET Get one item: Returns an individual item record, based on the item's database id.
  6. http://localhost:3000/api/v1/items

    • POST Create (then delete) one item: Creates an item based on input params and then deletes the created item.
  7. http://localhost:3000/api/v1/items/{{item_id}}

    • PUT Update one item: Updates an item based on input params.
  8. http://localhost:3000/api/v1/items/{{item_id}}/merchant

    • GET Get an item's merchant: Returns the merchant record that a given item belongs to.
  9. http://localhost:3000/api/v1/merchants/find?name

    • GET Find one merchant by name fragment: Returns a merchant record based on a name query param.
  10. http://localhost:3000/api/v1/items/find_all

    • GET Find all items by name fragment: Returns all item records based on a name query param.
  11. http://localhost:3000/api/v1/revenue/merchants

    • GET Get merchants with most revenue: Returns a quantity of top selling merchants based on their revenue. Revenue is determined by successful transaction result and shipped invoices. The user inputs a query param, quantity, which determines the number of merchants which will be returned.
  12. http://localhost:3000/api/v1/merchants/most_items

    • GET Get merchants who have sold the most items: Returns a quantity of top selling merchants based on the number of their items which have sold. Items are considered sold when there is a successful transaction result and a shipped invoice. The user inputs a query param, quantity, which determines the number of merchants which will be returned.
  13. http://localhost:3000/api/v1/revenue/merchants/{{merchant_id}}

    • GET Get revenue of a single merchant: Returns the revenue of a single merchant. Revenue is determined by successful transaction result and shipped invoices.
  14. http://localhost:3000/api/v1/revenue/items

    • GET Get items with most revenue: Returns a quantity of top selling items based on the revenue generated by item. Revenue is determined by successful transaction result and shipped invoices. The user inputs a query param, quantity, which determines the number of items which will be returned.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published