OpenFecApi

Gem Version

A ruby wrapper for 18F's Open FEC (Federal Elections Commission) API.

Installation

Add gem 'open_fec_api' to your application's Gemfile and run bundle install, or install manually with gem install open_fec_api.

Configuration

Configure a client with your API key before making requests.

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

Usage

Make a request.

response = client.candidates

Request different pages by setting the :page request parameter. Avoid rate-limits by increasing the :per_page request parameter to 100.

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

Make requests using endpoint-specific parameters.

options = {:party => "DEM"}
response = client.candidates(options)

Contributing

Help wrap all the endpoints!

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).

Installation

Check out the repo with git clone [email protected]:debate-watch/open-fec-api-ruby.git, and cd open-fec-api-ruby.

After checking out the repo, run bin/setup to install dependencies.

Testing

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

You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

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.