Rails Engine is a project that exposes data that powers a mock E-Commerce Application site through an API that the front end will consume using service-oriented architecture for building the API.
To run the web application on your local machine, you can fork and clone down the repo and follow the installation instructions below.
-
Install the gem packages
bundle install
-
Create the database by running the following command in your terminal
rails db{:drop,:create,:migrate,:seed}
To run this application you will need Ruby 2.7.2 and Rails 5.2.6
RSpec testing suite is utilized for testing this application.
- Run the RSpec suite to ensure everything is passing as expected
bundle exec rspec
Postman can also be used for testing by following the instructions found here
The following is a depiction of the Database Schema
GET /api/v1/items/find?name=<query>
Find one item based on name searchGET /api/v1/items/find_all?name=<query>
Find all items that match a name searchGET /api/v1/items
Returns all itemsPOST /api/v1/items
Create an ItemGET /api/v1/item/:id
Get one Item by idPATCH /api/v1/items/:id
Edit an ItemDELETE /api/v1/items/:id
Delete an ItemGET /api/v1/items/:id/merchant
Get the Merchant data for a given Item ID
GET /api/v1/merchants/find?name=<query>
Find one merchant based on name searchGET /api/v1/merchants/find_all?name=<query>
Find all merchants that match a name searchGET /api/v1/merchants/most_items?quantity=<query>
Find the quantity of merchants with the most items soldGET /api/v1/merchants
Returns all merchantsGET /api/v1/merchant/:id
Get one merchant by idGET /api/v1/merchants/:id/items
Get all Items for a given Merchant ID
GET /api/v1/revenue/merchants?quantity=<query>
Find the quantity of merchants with the highest revenueGET /api/v1/revenue/merchants/:id
Find the total revenue for a given merchantGET /api/v1/revenue?start=<start_date>&end=<end_date>
Find the total revenue for a specific time spanGET /api/v1/revenue/items?quantity=<query>
Find the quantity of items that have the top revenueGET /api/v1/revenue/unshipped?quantity=<x>
Find the potential revenue for the quantity given for items that are unshipped
GET /api/v1/merchants?per_page=50&page=2
Get all merchants with quantity per page and/or page number.GET /api/v1/items?per_page=50&page=2
Get all Items with quantity per page and/or page number.
- Ruby
- Rails
- RSpec
- factory_bot_rails
- faraday
- faker
- jsonapi-serializer
- Ruby 2.7.2
- Rails 5.2.6