https://quality-inventory.herokuapp.com
Ruby version
ruby-2.5.5
Configuration
bundle install
Database creation
bundle exec rake db:create bundle exec rake db:migrate
Database initialization
bundle exec rake db:seed
How to run the test suite
bundle exec rspec
Deployment instructions
bundle exec rails s
Product Table - has many Units Fields: title - required; must not be blank manufacturer - required; must not be blank
Unit Table - belongs to Product Fields: product_id - required; must exist status - required; either "active" or "inactive" condition - required; either "new" or "used" price_cents - must be greater than 0
[
{
"id": 1,
"title": "Synergistic Iron Watch",
"manufacturer": "Wolff and Sons"
},
{
"id": 2,
"title": "fake titles",
"manufacturer": "fake manufacturers"
}
]
200 OK
{
"id": 1,
"title": "Synergistic Iron Watch",
"manufacturer": "Wolff and Sons"
}
200 OK
{
"id": 1,
"title": "Synergistic Iron Watch",
"manufacturer": "Wolff and Sons",
"units": [
{
"id": 1,
"status": "active",
"condition": "new",
"price_cents": 999,
"product_id": 1
},
{
"id": 2,
"status": "inactive",
"condition": "used",
"price_cents": 899,
"product_id": 1
}
]
}
200 OK
HEADERS Content-Type: application/json
REQUEST BODY
{
"title": "fake title",
"manufacturer": "fake manufacturer"
}
201 Created
HEADERS Content-Type: application/json
REQUEST BODY
{
"title": "fake title",
"manufacturer": "fake manufacturer"
}
200 OK
[
{
"id": 1,
"status": "active",
"condition": "new",
"price_cents": 999,
"product_id": 1
},
{
"id": 2,
"status": "inactive",
"condition": "used",
"price_cents": 899,
"product_id": 1
}
]
200 OK
HEADERS Content-Type: application/json
REQUEST BODY
{
"id": 1,
"status": "active",
"condition": "new",
"price_cents": 999,
"product_id": 1
}
201 Created