Ruby vesion 2.7.2, Rails version 6.1.1
Clone app:
git clone https://github.com/imFawkes/stocks_api <directory>
Add gems:
bundle install
Setup DB:
rails db:setup
Run server in one terminal window:
rails s
transfer products from one warehouse to another:
curl -i -d '{"warehouse_id":"1", "new_warehouse_id":"2", "quantity":"5"}' -H "Content-Type: application/json" -X POST http://localhost:3000/products/1/transfer
sell products with passed quantity:
curl -i -d '{"product_id":"2", "quantity":"5"}' -H "Content-Type: application/json" -X POST http://localhost:3000/products/2/sell