Skip to content

Latest commit

 

History

History
60 lines (37 loc) · 1.96 KB

README.rdoc

File metadata and controls

60 lines (37 loc) · 1.96 KB

opensecrets

A Ruby wrapper around the OpenSecrets.org API.

You will need to have an OpenSecrets.org API key before you can use this library.

See the OpenSecrets API documentation at : www.opensecrets.org/action/api_doc.php

This project was inspired by a project suggestion on the SunlightLabs.com website. If you would like to contribute please see : sunlightlabs.com/projects/opensecrets-ruby/

Installation

[sudo] gem install opensecrets

Usage

require 'rubygems'
require 'opensecrets'
require 'crack'
require 'pp'

# Note, you can also provide your API key in an environment variable for security and convenience.
#   export OPENSECRETS_API_KEY=YOUR_API_KEY
# If you provide your key this way you do not have to provide a key in the OpenSecrets::*.new constructors.
# A key provided to the constructor overrides any environment variable that is set.

member = OpenSecrets::Member.new('YOUR OPEN SECRETS API KEY')
pp member.pfd({:cid => 'N00007360', :year => '2008'})["response"]

cand = OpenSecrets::Candidate.new('YOUR OPEN SECRETS API KEY')
pp cand.summary({:cid => 'N00007360'})["response"]

com = OpenSecrets::Committee.new('YOUR OPEN SECRETS API KEY')
pp com.by_industry({:cmte => 'HARM', :congno => '110', :indus => 'F10'})["response"]

Project Websites

TODO

  • Shoulda Tests. As there are currently none.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history.

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 Glenn Rempe. See LICENSE for details.