Voting API

An API that gives you access to race, candidate, voter and vote information.

Getting started

Install the necessary gems

bundle install

Get your server up and running

bin/rails server

Create a new candidate

POST /candidates/create?name=[name]

Register as a voter

POST /voters/create?name=[name]&party=[party]

You'll receive your voter token in the response. This will be used later in order to be able to edit voter info, cast a vote, and delete a vote.

Cast a vote

POST /votes/create?voter_id=[your_voter_id]&candidate_id=[candidate_id]&token=[your_voter_access_token]

This action will not work with an incorrect token or if a vote has already been cast.

DB Schema

An ERD can be found here