Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
OpenSecrets.org API Ruby Wrapper
Ruby
branch: master

Merge pull request #1 from jimgreer/master

.blank? isn't part of core ruby
latest commit 343879f4e4
@grempe authored
Failed to load latest commit information.
examples Better handling of API keys and allow use of OPENSECRETS_API_KEY envi…
lib .blank? is not core ruby, sadly
test Initial commit to opensecrets.
.document Initial commit to opensecrets.
.gitignore Commit of basic working API wrapper using HTTParty.
.yardopts Added .yardopts file.
LICENSE Initial commit to opensecrets.
README.rdoc Clarify installation of the gem, so it pulls from gemcutter.
Rakefile
VERSION Version bump to 0.0.5
opensecrets.gemspec Regenerated gemspec for version 0.0.5

README.rdoc

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 -s http://gemcutter.org

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

Copyright © 2009 Glenn Rempe. See LICENSE for details.

Something went wrong with that request. Please try again.