/promotions

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. Discount promotions usually apply for a given duration (e.g., sale for 1 week only). It's up to you to get creative. You should use Python enumerations to represent the different promotion types. A good action for the promotions API is to be able to activate and deactivate a promotion.

Primary LanguagePythonApache License 2.0Apache-2.0

Promotions Service

Build Status Build Status codecovLicense made-with-python

This repository contains sample code for Customer promotions for an e-commerce web site. This shows how to create a REST API with subordinate resources.

Information about this repo

These are the RESTful routes for promotions

Endpoint          Methods  Rule
----------------  -------  -----------------------------------------------------
index             GET      /

list_promotions     GET      /promotions
create_promotion   POST     /promotions
get_promotion     GET      /promotions/<promotion_id>
update_promotion   PUT      /promotions/<promotion_id>
delete_promotion   DELETE   /promotions/<promotion_id>

The test cases have 95% test coverage and can be run with nosetests

Deployment

  • Open in DevContainer

make login Logs into ibmcloud (you must have your api key in your host ~/.bluemix/apikey.json to be mounted by dev container)

kubectl get all See everything thats running

kubectl get svc See services

ibmcloud ks workers --cluster nyu-devops Get public ip of Kube worker node

Runs on WORKERNODE_PUBLIC_IP:31000

On first deploy:

make build

kubectl apply -f deploy/postgresql.yaml Deploys postgres db

kubectl create -f deploy/deployment.yaml Deploys app using our promotions image, creates deployment, replicaset and pods

kubectl create -f deploy/service.yaml Make accessible through service

License