Module: InfluenceExplorer

Defined in:
lib/influence_explorer.rb,
lib/influence_explorer/config.rb,
lib/influence_explorer/grants.rb,
lib/influence_explorer/version.rb,
lib/influence_explorer/entities.rb,
lib/influence_explorer/lobbying.rb,
lib/influence_explorer/contracts.rb,
lib/influence_explorer/aggregates.rb,
lib/influence_explorer/contributions.rb

Defined Under Namespace

Modules: Config Classes: Aggregates, Contracts, Contributions, Entities, Grants, Lobbying

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.base_urlObject



8
9
10
# File 'lib/influence_explorer.rb', line 8

def self.base_url
  'http://transparencydata.com/api/1.0/'
end

.request(endpoint, options) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/influence_explorer.rb', line 12

def self.request(endpoint, options)
  opts = options.merge('apikey' => InfluenceExplorer::Config.api_key)
  url = base_url + endpoint + "?" + opts.to_query
  # puts url
  response = JSON.parse(RestClient.get(url).to_str).collect {|i| Hashie::Mash.new(i) }
  response
end