0.0
No commit activity in last 3 years
No release in over 3 years
A ruby interface to the Open Federal Elections Commission (FEC) API. Returns data about election candidates and committees. Includes options to customize API requests.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 0.10
~> 10.0
~> 3.1
>= 0

Runtime

~> 0.13
 Project Readme

OpenFecApi

Gem Version

A ruby interface to the Open Federal Elections Commission (FEC) API. Returns data about election candidates and committees. Includes options to customize API requests.

Installation

gem install open_fec_api

Prerequisites

Obtain an API key.

Usage

client = OpenFecApi::Client.new("api_key_123")

candidates_response = client.candidates

candidate_response = client.candidate("P00003392")

committees_response = client.committees

committees_response = client.committee("C00571372")

Configuration Options

Request subsequent pages and avoid rate-limits.

options = {:page => 1, :per_page => 100}
response = client.candidates(options)

while response.page < response.pages do
  options.merge!({:page => response.page + 1})
  response = client.candidates(options)
end

Specify endpoint-specific parameters.

options = {:party => "DEM"}

response = client.candidates(options)

Contributing

Help establish and maintain full API endpoint coverage.

Browse existing issues or create a new issue to communicate bugs, desired features, etc.

After forking the repo and pushing your changes, create a pull request referencing the applicable issue(s).

Developing

git clone git@github.com:data-creative/open-fec-api-ruby.git
cd open-fec-api-ruby

Run bin/setup to install dependencies.

Obtain an API key and assign it to an environment variable called OPEN_FEC_API_KEY.

Testing

Run bundle exec rake or bundle exec rspec spec/ to run the tests.

Run bin/console for an interactive prompt to facilitate experiment.

Run bundle exec rake install to install the packaged gem onto your local machine for testing in other local projects.

Releasing

Update the version number in version.rb, then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.