public
Description: Ruby bindings to universally access a variety of Government APIs
Homepage:
Clone URL: git://github.com/pitosalas/govsdk.git
pitosalas (author)
Mon Mar 02 17:03:47 -0800 2009
commit  ed62838b13b19291653806f3eeee0ed1f53d3399
tree    49ceb5d0b7df3dd14af32541273004e089f92546
parent  6fc5e578459158c5a812f5b799c5b6b474e57d9a
govsdk /
name age message
file .gitignore Thu Jan 29 12:43:19 -0800 2009 Initial commit to govsdk. [pitosalas]
file LICENSE Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
file README.textile Wed Feb 25 16:49:47 -0800 2009 Added Util class. Updated the readme a little. ... [pitosalas]
file Rakefile Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
file VERSION.yml Mon Mar 02 17:02:43 -0800 2009 Version bump to 0.0.6 [pitosalas]
file changes.textile Wed Feb 25 16:49:47 -0800 2009 Added Util class. Updated the readme a little. ... [pitosalas]
directory doc/ Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
directory examples/ Wed Feb 25 17:02:58 -0800 2009 Added a brief example, fixed a tiny bug [pitosalas]
directory features/ Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
file govsdk.gemspec Mon Mar 02 17:03:47 -0800 2009 Add Utils class. Clean up a little [pitosalas]
directory lib/ Mon Mar 02 17:03:47 -0800 2009 Add Utils class. Clean up a little [pitosalas]
directory pkg/ Mon Mar 02 17:03:47 -0800 2009 Add Utils class. Clean up a little [pitosalas]
file src_template.rb Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
directory test/ Mon Mar 02 17:03:47 -0800 2009 Add Utils class. Clean up a little [pitosalas]
file todo.textile Mon Feb 16 12:29:36 -0800 2009 Some refactoring, adding stuff [pitosalas]
README.textile

Overview

THIS IS INCOMPLETE. I AM STILL WORKING ON IT

LICENSE

GovSDK is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

GovSDK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GovSDK. If not, see <http://www.gnu.org/licenses/>.

INTRODUCTION

There are numerous ‘government’ APIs from various organizations. This SDK is a model for accessing all of them in a simple and consistent way. I will try to insulate users of this library from changes that might happen in one SDK or another, and where information is available from different sources, pick the source that seems to be the most authoritative at the time. The idea is that by using this API, the developer can stay blissfully unaware of the underlying APIs, as they evolve and change.

KEY IDEAS

API Keys

Unfortunately for now, each of the different services request that you use it’s own API key to get permission to access them. So right off the bat, there’s a way that the abstraction will leak. It can’t be helped, the user of this library will have to acquire API keys for the relevant services and supply them.

IDs

There are various IDs (identifiers assigned by some outside, real world agency to some outside real world thing) throughout the government. One you know is a drivers license number assigned to a person.

Basic usage

Here is a very simplistic minimal example:


  1. You always have to start off by declaring that you want to use Govsdk. You need to supply one or more of your API keys.
    GovSdk.init :sunlight => “enter your API key…”

#Lookup a congress person “barney” “frank”. The call returns an array of matching congresspeople
cp = CongressPerson.find_by_names(“barney”, “frank”)

  1. print the photo url of the first congress person matching
    puts cp0.photo_url

KEY CLASSES

  1. CongressPerson – Work with legislators: senators and congressmen
  1. self.find_by_name – return an array of CongressPersons
  2. self.find_by_zipcode – return an array of CongressPersons
  3. self.find_by_crp_id – return the CongressPerson with specified crp id

Internal classes

  1. APIMgr – Parent class of each of the manager classes below
    1. NewYorkTimesAPI – Class managing access to the New York Times API
    2. SunlightAPI – Class managing access to the Sunlight API
    3. SpenSecretsAPI – Class managing the OpenSecrets API
      1. Methods: setAPIKey/getAPIKey

Utils

There are lots of simple transformations which come up in using these
APIs and so for convenience sake some of those are built right into this library

Utils.lookup_state_name(string) → two letter state code for that state