Rails engine is a backend E-commerce application providing full CRUD functionality API endpoints for Merchants and their Items following the ReST principles. This application provides a total of 28 endpoints including:
- 20 ReST endpoints for merchants and items as well as their relational endpoints
- 2 endpoints for the '/find' search capabilities to return a single item/merchant finder under one param query
- 2 endpoints for the '/find_all' also a search feature that will it returns a list of merchant/items
- 1 endpoints for the 'merchants/most_revenue' that takes in a quantity param that will return an endpoint with the top x number of merchants with the most revenue
- 1 endpoints for the '/merchants/most_items' which also takes in a quantity param, but will return the top x merchants who have sold the most items
- 1 endpoints for the '/revenue' which takes in two date params and will return an endpoint with the total revenue across all merchants during that time period
- 1 endpoints for the '/merchants/:id/revenue' returns an endpoint with the revenue of a single merchant Endpoints were constructed using Active record.
Ruby 2.5.3
Rails 5.2.4.3
git clone [email protected]:Kathybui732/rails_engine.git
cd rails_engine
bundle install
rake db:{create,migrate}
bundle exec rake import
to seed your databasebundle exec rspec
to run the test suite
Here is one set of full CRUD functionality endpoints. To see all endpoints available, please checkout my docs here!
- The base URL for this application is ``
For a list of all merchants recorded in the database
response
{
"data": [
{
"id": "1",
"type": "merchant",
"attributes": {
"name": "Schroeder-Jerde"
}
},
{
"id": "2",
"type": "merchant",
"attributes": {
"name": "Klein, Rempel and Jones"
}
}
]
}
For information about a specific merchant
{
"data": {
"id": "1",
"type": "merchant",
"attributes": {
"name": "Schroeder-Jerde"
}
}
}
To create a new merchant
Body
{
"name": "New Merchant"
}
Response
{
"data": {
"id": "101",
"type": "merchant",
"attributes": {
"name": "New Merchant"
}
}
}
To update information about a merchant
{
"name": "New Name"
}
Response
{
"data": {
"id": "101",
"type": "merchant",
"attributes": {
"name": "New Name"
}
}
}
To delete a merchant record
This endpoint returns a 204, No Content.
- Response needs:
- to be accounted for when users enter something other than a number for an id when making a get request
- Users entering in multiple params
- Get requests for a merchant's show page that does not exist should return 204/404 status response
- The search queries using dates have to be entered in exactly a format such as this: '2012-03-27 14:53:59 UTC' - could tweak filter method to allow for other date syntaxes to work
- Destroy methods destroy the record of the merchant or item, direct dependencies are accounted for, but secondary connections are not accounted for. Some records might be left with empty merchant or item ID numbers.
- Sometimes the queries return with no results, this usually just returns an empty JSON - equivilent to 204?