public
Description: OpenSecrets.org API Ruby Wrapper
Homepage: http://sunlightlabs.com/projects/opensecrets-ruby/
Clone URL: git://github.com/grempe/opensecrets.git
name age message
file .document Wed Nov 04 13:59:51 -0800 2009 Initial commit to opensecrets. [grempe]
file .gitignore Wed Nov 04 16:32:13 -0800 2009 Commit of basic working API wrapper using HTTPa... [grempe]
file .yardopts Wed Nov 04 17:05:49 -0800 2009 Added .yardopts file. [grempe]
file LICENSE Wed Nov 04 13:59:51 -0800 2009 Initial commit to opensecrets. [grempe]
file README.rdoc Thu Nov 05 12:29:30 -0800 2009 Clarify installation of the gem, so it pulls fr... [grempe]
file Rakefile Wed Nov 04 16:32:13 -0800 2009 Commit of basic working API wrapper using HTTPa... [grempe]
file VERSION Thu Nov 05 11:51:29 -0800 2009 Version bump to 0.0.5 [grempe]
directory examples/ Thu Nov 05 11:38:51 -0800 2009 Better handling of API keys and allow use of OP... [grempe]
directory lib/ Thu Nov 05 11:51:14 -0800 2009 DRY up the class initialization into a Base cla... [grempe]
file opensecrets.gemspec Thu Nov 05 11:51:30 -0800 2009 Regenerated gemspec for version 0.0.5 [grempe]
directory test/ Wed Nov 04 13:59:51 -0800 2009 Initial commit to opensecrets. [grempe]
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.