A simple vending machine CLI written in plain MRI Ruby and ActiveRecord with a PostgreSQL backend
This is a CLI app with a database. Users and Administrators can use the CLI to perform their respective actions.
User Actions:
- View the product inventory
- Purchase a desired product by specifying quantity to buy and money (£)
- User will be returned appropriate balance (if possible) if they chose to not pay the exact amount
Admin Actions:
- View the product inventory
- View the cash register (See all denominations and quantity available)
- Register a new product
- Modify product stock
- Modify amount of change in Vending Machine Cash Register
4 hours
- All application files are in the
lib
directory - The starting point of the application is the
vending_machine_app.rb
file - Tests are in the
spec
directory - Change calculation - Using a greedy approach to calculate the change denominations to be returned
- Ruby (2.6.5)
- PostgreSQL
- ActiveRecord (Not Rails)
- Rspec
Make sure psql server is running locally
- PostgreSQL
brew install postgresql
1 Copy Config
cp ./config/settings.yml.sample ./config/settings.yml
2 Run setup file
bin/setup
To start the CLI run the following
bin/vending_machine
To quit you can press ctrl+c
Karun - main@vkarun.me