/FetchPoints

API for using points on Fetch

Primary LanguagePython

FetchPoints

Points System for Fetch

A system to gain or utilize points via transactions

Features

  • Commit (multiple) transactions
  • Give points to payers
  • Use points (optional: from certain payers)
  • Return a list of points from payers

Tech

FetchPoints uses a number of open source projects to work properly:

  • Flask - Micro Web Framework which utilizes Python
  • PyMongo - Establishes connection with MongoDB via Python

Installation

FetchPoints requires Flask and PyMongo to run.

Install the dependencies and start the server.

pip install pymongo Flask

Usage

Run app.py to start the server up.

Route Required
/api/spend_points int Amount
/api/give_points int Amount, string payer
/api/balance None

api/spend_points - Spends points based on amount given.

api/give_points - Get points from payer based on amount

api/balance - Returns the amount of points from each payer

Testing

To run the test cases, you have to run the app.py first then run the test.py. You may be required to install importlib and requests. If you don't have it, use pip install importlib requests.

WARNING: Testing resets the database so only do this during development.