This project uses provided sales data to provide a basic API for accessing that data. You can also run a variety of business intelligence queries against the database. Data is returned in the JSON format. Here are some sample requests:
Visiting /api/v1/merchants/
returns:
[
{
"id":1,
"name":"Schroeder-Jerde"
},
{
"id":2,
"name":"Klein, Rempel and Jones"
},
{
"id":3,
"name":"Willms and Sons"
}
]
Visiting /api/v1/merchants/find?name=Kozey%20Group
returns:
{
"id":12,
"name":"Kozey Group"
}
[
{
"id":210,
"name":"Item Aut Sit",
"description":"Rerum eos sapiente repellendus cupiditate praesentium. Nulla sint quisquam corrupti autem. Sapiente unde doloremque non et sunt ipsa.",
"unit_price":"244.29",
"merchant_id":12
},
{
"id":211,
"name":"Item Commodi Eveniet",
"description":"Et exercitationem quas et expedita enim laborum. Facere incidunt illum expedita praesentium. Sequi ut labore sint in.",
"unit_price":"77.37",
"merchant_id":12
}
]
Visiting /api/v1/merchants/12/revenue
returns:
{
"revenue":"725116.93"
}
To get started, run bundle
from the command line in the root application directory.
To setup the database for initialization, run rake db:{create,migrate}
from the command line.
To import sales data from the provided CSV files, run rake import:csv
from the command line. This process may take a few minutes.
To run the test suite, run rspec
from the command line to run the full test suite. You can also run rspec <path_to_spec_file>
from the command line to run just one test, or run rspec spec/<models || requests>
from the command line to run either model tests OR request tests.