Find the project spec here
Rails Engine is a 7 day, 1 person project, during Mod 3 of 4 for Turing School's Back End Engineering Program.
The challenge was to build a fully functional JSON API 1.0 spec-compliant REST API that exposes endpoints for multiple resources from a relational database, modeling a true back-end framework that could be consumed by an entirely separate front-end framework.
Learning goals and areas of focus consisted of:
- Exposing a RESTful JSON API
- Using serializers to format JSON responses
- Testing API exposure, including edge case coverage and error handling
- Writing SQL statements without the assistance of an ORM
👤 Taylor Varoglu
- Github: Taylor Varoglu
- LinkedIn: Taylor Varoglu
GET
Merchants
- Get All Merchants:
{{base_url}}/api/v1/merchants
- Optional
query params
for pagination:?per_page=<integer>
?page=<integer>
- Optional
- Get Merchant by Id:
{{base_url}}/api/v1/merchants/{{id}}
- Get Merchant by Name:
{{base_url}}/api/v1/merchants/find?name={{search_param}}
- REQUIRED
query params
for search:?name=<string>
- REQUIRED
- Get Merchant's Items:
{{base_url}}/api/v1/merchants/{{id}}/items
- Get Top Merchants by Items Sold:
{{base_url}}/api/v1/merchants/most_items?quantity={{search_param}}
- REQUIRED
query params
for search:?quantity=<integer>
- REQUIRED
GET
Items
- Get All Items:
{{base_url}}/api/v1/items
- Optional
query params
for pagination:?per_page=<integer>
?page=<integer>
- Optional
- Get Item by Id:
{{base_url}}/api/v1/items/{{id}}
- Get Item by Name:
{{base_url}}/api/v1/items/find_all?name={{search_param}}
- REQUIRED
query params
for search:?name=<string>
- REQUIRED
- Get Item's Merchant:
{{base_url}}/api/v1/items/{{id}}/merchant
GET
Revenue
- Get Merchants Ranked by Revenue:
{{base_url}}/api/v1/revenue/merchants?quantity={{search_param}}
- REQUIRED
query params
for search:?quantity=<integer>
- REQUIRED
- Get Revenue for a Merchant:
{{base_url}}/api/v1/revenue/merchants/{{id}}
- Get Items Ranked by Revenue:
{{base_url}}/api/v1/revenue/items
- Optional
query params
for search:?quantity=<integer>
- Optional
This project requires Ruby 2.7.2 and Rails 5.2.6.
- Fork this repository
- Install gems and set up your database:
bundle
rails db:{drop,create,migrate,seed}
rails db:schema:dump
- Run the test suite with
bundle exec rspec -fd
- Run your development server with
rails s
-
Ruby version
$ ruby -v ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
-
$ rails -v Rails 5.2.6
-
Database creation
$ rails db:{drop,create,migrate,seed} ... $ rails db:schema:dump
-
How to run the test suite
$ bundle exec rspec -fd
-
Local Deployment, for testing:
$ rails s => Booting Puma => Rails 5.2.6 application starting in development => Run `rails server -h` for more startup options Puma starting in single mode... * Version 3.12.6 (ruby 2.7.2-p137), codename: Llamas in Pajamas * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://localhost:3000 Use Ctrl-C to stop