Welcome to NYU DevOps Spring 2018 Promotion team! The promotions resource is a representation of a special promotion or sale that is running against a product or perhaps the entire store. Some examples are "buy 1 get 1 free", "20% off" etc.
Our promotion service is hosted on IBM Bluemix with an automated CI/CD DevOps pipeline. The base URLs of the service are
You can access the services through the simple UI we built at the base URL, or through API calls as described below.
Clone the repo
git clone https://github.com/DevOps2018-Promotions/promotions.git
cd promotions
If running in Windows, open Vagrantfile and comment out
# config.vm.network "private_network", ip: "192.168.33.10"
Otherwise you will get error,
VBoxManage.exe: error: Could not find Host Interface Networking driver! Please reinstall
vagrant up
vagrant ssh
If running in Windows, you might get a prompt from Windows Defender to allow Ruby to run. Click Allow access.
Once you are in the virtual machine, cd /vagrant
to where the code lives.
To double check, run nosetests
to see if all test cases pass.
Then run python server.py
.
Now, the server should be available at http://localhost:5000
The content-type
of the http request we accept is application/json
.
Our server allows the following operations
POST http://localhost:5000/promotions
GET http://localhost:5000/promotions/<int:promotion_id>
GET http://localhost:5000/promotions
GET http://localhost:5000/promotions?<query-string>
PUT http://localhost:5000/promotions/<int:promotion_id>
DELETE http://localhost:5000/promotions/<int:promotion_id>
POST http://localhost:5000/promotions/<int:promotion_id>/redeem
<int:promotion_id>
: Set automatically on creation. No one is supposed to modity this field.<str:name>
: After creation, it can be modified by PUT
.<int:product_id>
: After creation, it can be modified by PUT
.<int:discount_ratio>
: After creation, it can be modified by PUT
.<int:counter>
: Incremented on POST http://localhost:5000/promotions/<int:promotion_id>/redeem
. The field is associated with the promotion_id
, and will persist after UPDATEs.
More comming soon.