TwentySixteen
A source for data about the 2016 United States Presidential election. Includes a candidates endpoint.
Installation
Add this line to your application's Gemfile:
gem 'twenty_sixteen'
And then execute:
$ bundle
Or install it yourself as:
$ gem install twenty_sixteen
Usage
Client-side
Request the hosted JSON data file.
Server-side
Candidates
List all candidates running for President.
candidates = TwentySixteen::Candidate.all
Filter candidates.
dems = TwentySixteen::Candidate.democrat
reps = TwentySixteen::Candidate.republican
indies = TwentySixteen::Candidate.independent
active_dems = TwentySixteen::Candidate.where({:party=>"Democrat",:campaign_status=>"active"})
party_nomination_winners = TwentySixteen::Candidate.party_nominee
Find a specific candidate.
hrc = TwentySixteen::Candidate.find_by_url("https://www.hillaryclinton.com/")
donald = TwentySixteen::Candidate.find_by_last_name("Trump")
Contributing
Edit candidate data in lib/twenty_sixteen/candidates.json. Please add new slogans in sequential order of appearance.
- Fork it ( https://github.com/debate-watch/twenty_sixteen/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request