Installation Steps for Ubuntu

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.6.3
rvm use 2.6.3 --default
ruby -v
gem install bundler
gem install rails -v 6.0.2.1
bundle install
rake db:migrate
rails s

Finally, you can start testing.

Endpoints and request types

1. Get inventories

GET ```localhost:3000/inventories```

2. Get single inventory

GET ```localhost:3000/inventories/1```

3. Create inventory

POST ```localhost:3000/inventories```
Payload
{
	"name" : "test 1",
	"description" : "test desc 1",
	"price" : 10.52,
	"quantity": 10
}

4. Update inventory

Payload

PUT/PATCH localhost:3000/inventories/1

{
	"name" : "test 1",
	"description" : "test desc 1",
	"price" : 10.52,
	"quantity": 10
}

5. Delete inventory

DELETE localhost:3000/inventories/1

6. Get orders

GET localhost:3000/orders

7. Get single order

GET localhost:3000/orders/1

8. Create order

POST localhost:3000/orders

Payload
{
	"orders" : {
		"email": "testtest.com",
		"order_items": [
    		{
    			"inventory_id" : 4,
    			"quantity" : 1
    		},
    		{
    			"inventory_id" : 5,
    			"quantity" : 1
	    	}
		]
	}
}

9. Update order

PUT/PATCH localhost:3000/orders/1

Payload
{
	"orders" : {
		"email": "test@test.com",
		"order_items": [
    		{
    			"inventory_id" : 2,
    			"quantity" : 2
    		}
    	]
	}
}

10. Delete order

DELETE localhost:3000/orders/1

Running Test

rspec spec/requests/create_inventory_spec.rb
rspec spec/requests/create_order_spec.rb
rspec spec/requests/delete_inventory_spec.rb
rspec spec/requests/delete_order_spec.rb
rspec spec/requests/get_inventories_spec.rb
rspec spec/requests/get_orders_spec.rb
rspec spec/requests/update_inventory_spec.rb
rspec spec/requests/update_order_spec.rb