Module: Daywalker
- Defined in:
- lib/daywalker.rb,
lib/daywalker/base.rb,
lib/daywalker/district.rb,
lib/daywalker/geocoder.rb,
lib/daywalker/legislator.rb,
lib/daywalker/type_converter.rb,
lib/daywalker/dynamic_finder_match.rb
Overview
Daywalker is a Ruby-wrapper around the Sunlight API (wiki.sunlightlabs.com/Sunlight_API_Documentation). It implements all the functionality of the API related to Districts and Legislators (the Lobbyist API is considered experimental).
Before using the API, you must register for an API key: services.sunlightlabs.com/api/register/
After registering, you’ll receive an email with a link to activate the key.
To begin with, here’s a small example script to print out all the districts and legislators for a zipcode:
require 'rubygems'
require 'pp'
require 'daywalker'
Daywalker.api_key = 'the api key you received'
pp Daywalker::Legislator.all_by_zip(02114)
pp Daywalker::District.all_by_zip(02114)
See Daywalker::District and Daywalker::Legislator for more details on usage.
Defined Under Namespace
Classes: AddressError, BadApiKeyError, Base, District, DynamicFinderMatch, Geocoder, Legislator, NotFoundError, TypeConverter
Class Method Summary collapse
-
.api_key ⇒ Object
Get the API to be used.
-
.api_key=(api_key) ⇒ Object
Set the API to be used.
-
.geocoder ⇒ Object
:nodoc:.
-
.geocoder=(geocoder) ⇒ Object
:nodoc:.
Class Method Details
.api_key ⇒ Object
Get the API to be used
37 38 39 |
# File 'lib/daywalker.rb', line 37 def self.api_key @api_key end |
.api_key=(api_key) ⇒ Object
Set the API to be used. This must be set when using Daywalker, BadApiKeyErrors will be occur.
32 33 34 |
# File 'lib/daywalker.rb', line 32 def self.api_key=(api_key) @api_key = api_key end |
.geocoder ⇒ Object
:nodoc:
45 46 47 |
# File 'lib/daywalker.rb', line 45 def self.geocoder # :nodoc: @geocoder end |
.geocoder=(geocoder) ⇒ Object
:nodoc:
41 42 43 |
# File 'lib/daywalker.rb', line 41 def self.geocoder=(geocoder) # :nodoc: @geocoder = geocoder end |