This project is the back end for an eCommerce web site as a RESTful microservice for the Suppliers. An Supplier is a vendor from whom we get products from. This microservice supports the complete Create, Read, Update, & Delete (CRUD) lifecycle.
https://nyu-supplier-service-sum21-dev.us-south.cf.appdomain.cloud
https://nyu-supplier-service-sum21.us-south.cf.appdomain.cloud
https://cloud.ibm.com/devops/pipelines/4bf3eb13-4e76-4496-affe-fa81bd552499?env_id=ibm:yp:us-south
https://nyu-supplier-service-sum21.us-south.cf.appdomain.cloud/apidocs
service
├─ __init__.py - package initializer
├─ models.py - service database models
├─ routes.py - service routes settings
└─ status.py - service status codes
tests
├─ __init__.py - test initializer
├─ factories.py - module to generate the fake data
├─ test_models.py - test case for the models service
└─ test_routes.py - test case for the routes service
Field | Type | Primary Key | Descriptions |
---|---|---|---|
id | Integer | True | ID of the supplier |
name | String | False | Name of the individual or company name |
phone | String | False | Phone number of the supplier |
address | String | False | Address of the supplier |
available | Boolean(default True) | False | supplier availbility |
product_list | Integer List | False | Product id lists for each supplier |
rating | Float | False | Supplier rating |
Download VirtualBox and Vagrant.
For unix user, we recommend to install the environment via Homebrew:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then Executing the command to finish the installation:
$ brew install git
$ brew install --cask virtualbox
$ brew install --cask vagrant
To executing the service, type the following command in the terminal SSH:
$ git clone https://github.com/nyusuppliers/suppliers.git
$ cd suppliers
$ vagrant up
$ vagrant ssh
$ cd /vagrant
$ nosetests
To see the coverage report, type:
$ coverage report -m
Once finish, to close the VM and terminate service. Please type:
$ exit
$ vagrant halt
Once finish testing and no longer need it again. Please type following command to delete the service.
$ vagrant destroy
- End Point: GET /suppliers?param={query_param}
- Query Parameters:
- name (string)
- phone (string)
- address (string)
- available (boolean)
- rating (string)
- product_id (string)
- End Point: GET /suppliers/{supplier_id}
- Path Parameters:
- supplier_id (int)
- End Point: POST /suppliers
- Body Parameters:
- name (string)
- phone (string)
- address (string)
- available (boolean)
- rating (float)
- product_id (list of int)
- End Point: PUT /suppliers/{supplier_id}
- Path Parameters:
- supplier_id (int)
- Body Parameters:
- name (string)
- phone (string)
- address (string)
- available (boolean)
- rating (float)
- product_id (list of int)
- End Point: DELETE /suppliers/{supplier_id}
- Path Parameters:
- supplier_id (int)
- End Point: PUT /suppliers/{supplier_id}/penalize
- Path Parameters:
- supplier_id (int)