{"id":16548151,"url":"https://github.com/mscoutermarsh/contestant-poll","last_synced_at":"2025-08-21T10:17:16.191Z","repository":{"id":146219506,"uuid":"3178562","full_name":"mscoutermarsh/contestant-poll","owner":"mscoutermarsh","description":"Vote tracking API - With simple math authentication","archived":false,"fork":false,"pushed_at":"2012-02-24T05:13:01.000Z","size":272,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T10:54:57.027Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mscoutermarsh.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-14T15:43:17.000Z","updated_at":"2018-12-21T18:01:54.000Z","dependencies_parsed_at":"2023-03-23T17:02:15.826Z","dependency_job_id":null,"html_url":"https://github.com/mscoutermarsh/contestant-poll","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mscoutermarsh/contestant-poll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscoutermarsh%2Fcontestant-poll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscoutermarsh%2Fcontestant-poll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscoutermarsh%2Fcontestant-poll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscoutermarsh%2Fcontestant-poll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mscoutermarsh","download_url":"https://codeload.github.com/mscoutermarsh/contestant-poll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mscoutermarsh%2Fcontestant-poll/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271462091,"owners_count":24763858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T19:25:09.421Z","updated_at":"2025-08-21T10:17:16.163Z","avatar_url":"https://github.com/mscoutermarsh.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Contestant Poll API\r\n===========================\r\nAn API for tracking votes. To limit cheating, instead of using a captcha, use simple math!  \r\n  \r\n### **See it running on Heroku:** [HTML/JavaScript Implementation](http://voteAPI.heroku.com/vote.html \"voteAPI\")    \r\n\r\n\r\n1. Vote is created\r\n2. API asks a simple math question (What's 2+2?)\r\n3. If user answers correctly. Vote is counted in poll.\r\n\r\n\r\n\r\n**Setup:** Before running you must setup a couple environment variables:\r\n\r\n1. Define ENV variable `VOTECONN`. This is the connection string to your database.\r\n2. *Optional:* Define ENV variable `ALLOW_REF` with the domain you want to limit requests from.\r\n + **Example:** `ALLOWED_REF=voteAPI.heroku.com` will only allow record votes if the referer is from the specified domain. This will stop someone from hitting the API from another domain.\r\n\r\n\r\n\r\nAPI Documentation\r\n============================\r\n\r\nPOST\r\n----\r\n\r\n### Create a new Vote\r\n`Post: http://localhost:4567/vote/:contestant`\r\n\r\nCreates a new vote. Returns json containing the ID and the simple math problem.\r\n\r\nResponse:  \r\n`{\"question\":\"What is 4+3?\",\"id\":\"96\"}`\r\n\r\nAfter recieving this response, you must confirm the vote by answering the question (What is 4+3?).\r\n\r\n### Confirm Vote\r\n`Post: http://localhost:4567/confirm/:id/:answer`\r\n\r\n**Post:** ID and answer to question.\r\n\r\nIf correct: the vote will be valid and counted.  \r\n`{\"message\":\"Thanks for voting!\"}`\r\n\r\nIf incorrect: error message will be returned.  \r\n`{\"message\":\"Oops, wrong answer.\"}`\r\n\r\n\r\nGET\r\n----\r\n\r\n### Get count of votes\r\n\r\n`Get: http://localhost:4567/votes/:contestant`\r\n\r\nReturns number of validated votes for a contestant.\r\n\r\nResponse:  \r\n`{\"votes\":\"21\"}`\r\n\r\nThings to do\r\n============================\r\n+ Clean up JavaScript for example implementation.\r\n+ Record header information for the user. This could be used to filter out cheating beyond just IP.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscoutermarsh%2Fcontestant-poll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmscoutermarsh%2Fcontestant-poll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmscoutermarsh%2Fcontestant-poll/lists"}