Class: GovSdk

Inherits:
Object
  • Object
show all
Defined in:
lib/govsdk.rb

Overview

require “ruby-debug” Debugger.settings = 1 # list nearby lines on stop Debugger.settings = 1 Debugger.start

Class Method Summary collapse

Class Method Details

.google_apiObject



51
52
53
# File 'lib/govsdk.rb', line 51

def self.google_api
  @google_api
end

.init(apikeys = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/govsdk.rb', line 55

def self.init(apikeys = {})
  apikeys.keys.each { |x| raise ArgumentError unless [:google, :followmoney, :sunlight, :opensecrets, :votesmart].include?(x) }
  GovSdk.load_apis
  apikeys.each do |key, val|
    @sunlight_api.key = val if key == :sunlight
    @opensecrets_api.key = val if key == :opensecrets
    @followm_api.key = val if key == :followmoney
    @votesmart_api.key = val if key == :votesmart
    @google_api.key = val if key == :google
  end
end

.load_apisObject



32
33
34
35
36
37
# File 'lib/govsdk.rb', line 32

def self.load_apis
  @sunlight_api = SunlightApi.new
  @opensecrets_api = OpenSecretsApi.new
  @votesmart_api = VoteSmartApi.new
  @google_api = GoogleApi.new
end

.opensecrets_apiObject



47
48
49
# File 'lib/govsdk.rb', line 47

def self.opensecrets_api
  @opensecrets_api
end

.sunlight_apiObject



43
44
45
# File 'lib/govsdk.rb', line 43

def self.sunlight_api
  @sunlight_api
end

.votesmart_apiObject



39
40
41
# File 'lib/govsdk.rb', line 39

def self.votesmart_api
  @votesmart_api
end