Test merchandising store implementation. Includes model Product, Discount services and also small REST API to interact with application.
- Github
- Ruby 3.1.2 or more
git clone [email protected]:organization/project-name.git
cp config/database.yml.example config/database.yml
bundle install
bundle exec rake db:create db:setup
bundle exec rails s
curl http://localhost:3000/products -H 'Content-Type: application/json'
curl http://localhost:3000/products?q=hoo -H 'Content-Type: application/json'
curl -X PATCH 'http://localhost:3000/products/<product id>' -H 'Content-Type: application/json' -d '{"price": "6.7"}'
- <product id> - ID of the updated product
curl 'http://localhost:3000/products/total?items[<productId1>]=<productQuantity1>&items[<productId2>]=<productQuantity2>' -H 'Content-Type: application/json'
- <productId> - product ID in list -** <productQuantity>** - quantity of product in list
curl 'http://localhost:3000/products/total?discount=1&items[<productId1>]=<productQuantity1>&items[<productId2>]=<productQuantity2>' -H 'Content-Type: application/json'
- <productId> - product ID in list
- <productQuantity> - quantity of product in list
bundle exec rspec