The inventory resource keeps track of how many of each product we have in our warehouse.
To get started, download and install VirtualBox and Vagrant.
git clone git@github.com:Inventory-Squad/inventory.git
cd inventory
vagrant up
vagrant ssh
cd /vagrant
BDD integration tests are using Selenium to manipulate a web page on a running server.
Run the tests using behave
$ honcho start &
$ behave
Note that the &
runs the server in the background. To stop the server, you must bring it to the foreground and then press Ctrl+C
Stop the server with
$ fg
$ <Ctrl+C>
Alternately you can run the server in another shell
by opening another terminal window and using vagrant ssh
to establish a second connection to the VM. You can also suppress all log output in the current shell with this command:
honcho start 2>&1 > /dev/null &
or you can supress info logging with this command:
gunicorn --bind 0.0.0.0 --log-level=error service:app &
This will suppress the normal INFO
logging
This repo also has unit tests that you can run nose
$ nosetests
Nose is configured to automatically include the flags --with-spec --spec-color
so that red-green-refactor is meaningful. If you are in a command shell that supports colors, passing tests will be green while failing tests will be red.
When you are done, you can exit and shut down the vm with:
exit
vagrant halt
If the VM is no longer needed you can remove it with:
vagrant destroy
Fields | Type |
---|---|
id | String, read only |
product_id | Integer |
quantity | Integer |
restock_level | Integer, when to order more |
condition | String, {'new', 'open_box', 'used'} |
available | Boolean |
An API to allow management of inventory for an e-commerce website. It will support create, read, update, delete, list, query, and an action(disable an entry).
- PATH: POST
/inventory
- PATH: GET
/inventory/{string:id}
- PATH: GET
/inventory
- By product id: GET
/inventory?product-id={int:pid}
- By condition: GET
/inventory?condition={string:condition}
- By condition and product id: GET
/inventory?condition={string:condition}&product-id={int:pid}
- By need restock or not: GET
/inventory?restock={bool:needRestock}
- By restock level: GET
/inventory?restock-level={int:restock-level-value}
- By availability: GET
/inventory?available={bool:isAvailable}
- By availability and product id: GET /inventory?available={bool:isAvailable}&product-id={int:pid}
- PATH: DELETE
/inventory/{string:id}
- PATH: PUT
/inventory/{int:product-id}/disable
- PATH: PUT
/inventory/{string:id}
https://nyu-inventory-service-f19.mybluemix.net/
https://nyu-inventory-service-f19-prod.mybluemix.net/
https://cloud.ibm.com/devops/pipelines/5ef0d78c-44b1-4115-aa5d-8283a9ae61db?env_id=ibm:yp:us-south
https://nyu-inventory-service-f19-prod.mybluemix.net/apidocs/index.html