Permalink
Browse files

Merge pull request #20 from whatbird/master

use "sunlight_apikey" instead of "openstates_apikey"
  • Loading branch information...
2 parents 033c522 + cf2dbff commit 50113c0287ad2f6caf0127440a18fff35485380a OpenGovernment committed Nov 21, 2011
Showing with 15 additions and 2 deletions.
  1. +8 −0 README.md
  2. +7 −2 lib/gov_kit/configuration.rb
View
@@ -20,6 +20,14 @@ Add govkit to your environment.rb or Gemfile
Run <code>rails generate govkit</code> (Rails 3.x) or <code>script/generate govkit</code> (Rails 2.x) to copy a config file into <code>config/initializers/govkit.rb</code>. You will need to add your API keys to this config file.
+Outside of Rails you can configure your API keys like so:
+
+ >> GovKit.configure do |config|
+ >> config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY'
+ >> config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
+ >> config.ftm_apikey = 'YOUR_FTM_API_KEY'
+ >> end
+
# Usage Examples
>> GovKit::OpenStates::State.find_by_abbreviation('CA')
@@ -10,7 +10,7 @@ class Configuration
attr_accessor :bing_appid, :bing_base_url
def initialize
- @openstates_apikey = @votesmart_apikey = @ftm_apikey = ''
+ @sunlight_apikey = @openstates_apikey = @votesmart_apikey = @ftm_apikey = ''
@openstates_base_url = 'openstates.sunlightlabs.com/api/v1/'
@transparency_data_base_url = 'transparencydata.com/api/1.0/'
@votesmart_base_url = 'api.votesmart.org/'
@@ -30,6 +30,11 @@ def opencongress_apikey= key
warn "[DEPRECATION] OpenCongress no longer requires an API Key. Ability to set it will be removed in future versions"
@opencongress_apikey = key
end
+
+ def openstates_apikey= key
+ warn "[DEPRECATION] Use sunlight_apikey instead of openstates_apikey. Ability to set it will be removed in future versions"
+ @sunlight_apikey = key
+ end
end
class << self
@@ -45,7 +50,7 @@ def configuration
#
# @example
# GovKit.configure do |config|
- # config.openstates_apikey = ''
+ # config.sunlight_apikey = ''
# end
def self.configure
yield(configuration)

0 comments on commit 50113c0

Please sign in to comment.