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.
Forka copy of the repo to your Github accountClonethe forked repo onto your local computer- Run
bundle - Run
rails db:{drop,create,migrate,seed} - Run
rails sto fire up yourlocalhost:3000- This project is not currently hosted or deployed. As such, consumption and review of the API endpoints take place only in the
localenvironment
- This project is not currently hosted or deployed. As such, consumption and review of the API endpoints take place only in the
-
http://localhost:3000/api/v1/merchantsGETGet 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 theper_pagequery param.
-
http://localhost:3000/api/v1/merchants/{{merchant_id}}GETGet one merchant: Returns an individual merchant record, based on the merchant's database id.
-
http://localhost:3000/api/v1/merchants/{{merchant_id}}/itemsGETGet a merchant's items: Returns all items which belong to an individual merchant.
-
http://localhost:3000/api/v1/itemsGETGet 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 theper_pagequery param.
-
http://localhost:3000/api/v1/items/{{item_id}}GETGet one item: Returns an individual item record, based on the item's database id.
-
http://localhost:3000/api/v1/itemsPOSTCreate (then delete) one item: Creates an item based on input params and then deletes the created item.
-
http://localhost:3000/api/v1/items/{{item_id}}PUTUpdate one item: Updates an item based on input params.
-
http://localhost:3000/api/v1/items/{{item_id}}/merchantGETGet an item's merchant: Returns the merchant record that a given item belongs to.
-
http://localhost:3000/api/v1/merchants/find?nameGETFind one merchant by name fragment: Returns a merchant record based on anamequery param.
-
http://localhost:3000/api/v1/items/find_allGETFind all items by name fragment: Returns all item records based on anamequery param.
-
http://localhost:3000/api/v1/revenue/merchantsGETGet merchants with most revenue: Returns a quantity of top selling merchants based on their revenue. Revenue is determined bysuccessful transaction resultandshipped invoices. The user inputs a query param,quantity, which determines the number of merchants which will be returned.
-
http://localhost:3000/api/v1/merchants/most_itemsGETGet 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 asuccessful transaction resultand ashipped invoice. The user inputs a query param,quantity, which determines the number of merchants which will be returned.
-
http://localhost:3000/api/v1/revenue/merchants/{{merchant_id}}GETGet revenue of a single merchant: Returns the revenue of a single merchant. Revenue is determined bysuccessful transaction resultandshipped invoices.
-
http://localhost:3000/api/v1/revenue/itemsGETGet items with most revenue: Returns a quantity of top selling items based on the revenue generated by item. Revenue is determined bysuccessful transaction resultandshipped invoices. The user inputs a query param,quantity, which determines the number of items which will be returned.