govkit-h 0.7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/.rspec +3 -0
- data/Gemfile +13 -0
- data/LICENSE +20 -0
- data/README.md +70 -0
- data/Rakefile +82 -0
- data/USAGE +1 -0
- data/VERSION +1 -0
- data/generators/govkit/govkit_generator.rb +24 -0
- data/generators/govkit/templates/govkit.rb +24 -0
- data/govkit.gemspec +130 -0
- data/init.rb +4 -0
- data/lib/generators/govkit/govkit_generator.rb +21 -0
- data/lib/generators/govkit/templates/create_mentions.rb +21 -0
- data/lib/generators/govkit/templates/govkit.rb +24 -0
- data/lib/generators/govkit/templates/mention.rb +15 -0
- data/lib/gov_kit.rb +45 -0
- data/lib/gov_kit/acts_as_noteworthy.rb +63 -0
- data/lib/gov_kit/configuration.rb +58 -0
- data/lib/gov_kit/follow_the_money.rb +176 -0
- data/lib/gov_kit/open_congress.rb +125 -0
- data/lib/gov_kit/open_congress/bill.rb +171 -0
- data/lib/gov_kit/open_congress/blog_post.rb +15 -0
- data/lib/gov_kit/open_congress/news_post.rb +15 -0
- data/lib/gov_kit/open_congress/person.rb +141 -0
- data/lib/gov_kit/open_congress/person_stat.rb +13 -0
- data/lib/gov_kit/open_congress/roll_call.rb +14 -0
- data/lib/gov_kit/open_congress/roll_call_comparison.rb +28 -0
- data/lib/gov_kit/open_congress/voting_comparison.rb +44 -0
- data/lib/gov_kit/open_states.rb +132 -0
- data/lib/gov_kit/railtie.rb +24 -0
- data/lib/gov_kit/resource.rb +190 -0
- data/lib/gov_kit/search_engines.rb +7 -0
- data/lib/gov_kit/search_engines/bing.rb +38 -0
- data/lib/gov_kit/search_engines/google_blog.rb +32 -0
- data/lib/gov_kit/search_engines/google_news.rb +47 -0
- data/lib/gov_kit/search_engines/technorati.rb +35 -0
- data/lib/gov_kit/search_engines/wikipedia.rb +27 -0
- data/lib/gov_kit/transparency_data.rb +144 -0
- data/lib/gov_kit/vote_smart.rb +126 -0
- data/lib/govkit.rb +1 -0
- data/spec/fixtures/bing/news_search.response +1 -0
- data/spec/fixtures/bing/no_results.response +1 -0
- data/spec/fixtures/follow_the_money/business-page0.response +28 -0
- data/spec/fixtures/follow_the_money/business-page1.response +12 -0
- data/spec/fixtures/follow_the_money/contribution.response +12 -0
- data/spec/fixtures/follow_the_money/unauthorized.response +8 -0
- data/spec/fixtures/open_congress/person.response +8 -0
- data/spec/fixtures/open_states/401.response +10 -0
- data/spec/fixtures/open_states/404.response +9 -0
- data/spec/fixtures/open_states/410.response +6 -0
- data/spec/fixtures/open_states/bill.response +240 -0
- data/spec/fixtures/open_states/bill_query.response +1990 -0
- data/spec/fixtures/open_states/committee_find.response +53 -0
- data/spec/fixtures/open_states/committee_query.response +190 -0
- data/spec/fixtures/open_states/legislator.response +34 -0
- data/spec/fixtures/open_states/legislator_query.response +144 -0
- data/spec/fixtures/open_states/state.response +60 -0
- data/spec/fixtures/search_engines/google_news.response +8 -0
- data/spec/fixtures/transparency_data/contributions.response +18 -0
- data/spec/fixtures/transparency_data/entities_search.response +7 -0
- data/spec/fixtures/transparency_data/entities_search_limit_0.response +7 -0
- data/spec/fixtures/transparency_data/entities_search_limit_1.response +7 -0
- data/spec/fixtures/transparency_data/grants_find_all.response +7 -0
- data/spec/fixtures/transparency_data/lobbyists_find_all.response +7 -0
- data/spec/follow_the_money_spec.rb +61 -0
- data/spec/open_congress_spec.rb +108 -0
- data/spec/open_states_spec.rb +213 -0
- data/spec/search_engines_spec.rb +44 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/transparency_data_spec.rb +106 -0
- metadata +258 -0
data/.document
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Participatory Politics Foundation
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Govkit
|
2
|
+
|
3
|
+
Govkit is a Ruby gem that provides simple access to US open government APIs around the web, including:
|
4
|
+
|
5
|
+
* [OpenCongress](http://www.opencongress.org/api), which has an API for federal bills, votes, people, and news and blog coverage
|
6
|
+
* [The Open States project](http://fiftystates-dev.sunlightlabs.com/), which has a RESTful API for accessing data about state legislators, bills, votes, etc.
|
7
|
+
* [Project Vote Smart](http://www.votesmart.org/services_api.php), which has an API with congressional addresses, etc.
|
8
|
+
* [Follow The Money](http://www.followthemoney.org/), whose API reveals campaign contribution data for state officials.
|
9
|
+
* [TransparencyData API](http://transparencydata.com/api) (campaign contributions only)
|
10
|
+
|
11
|
+
# Installation
|
12
|
+
|
13
|
+
From gemcutter:
|
14
|
+
|
15
|
+
gem install govkit
|
16
|
+
|
17
|
+
# Setup
|
18
|
+
|
19
|
+
Add govkit to your environment.rb or Gemfile
|
20
|
+
|
21
|
+
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.
|
22
|
+
|
23
|
+
Outside of Rails you can configure your API keys like so:
|
24
|
+
|
25
|
+
>> GovKit.configure do |config|
|
26
|
+
>> config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY'
|
27
|
+
>> config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
|
28
|
+
>> config.ftm_apikey = 'YOUR_FTM_API_KEY'
|
29
|
+
>> end
|
30
|
+
|
31
|
+
# Usage Examples
|
32
|
+
|
33
|
+
>> GovKit::OpenStates::State.find_by_abbreviation('CA')
|
34
|
+
>> GovKit::VoteSmart::Address.find(votesmart_candidate_id)
|
35
|
+
>> GovKit::OpenCongress::Bill.find(:number => 5479, :type => 'h', :congress => '111')
|
36
|
+
|
37
|
+
Objects returned from GovKit will have attributes for each field coming back from the API:
|
38
|
+
|
39
|
+
>> x = GovKit::OpenStates::State.find_by_abbreviation('CA')
|
40
|
+
=> #<GovKit::OpenStates::State:0x00000100f6a5a8 @attributes={"lower_chamber_title"=>"Assemblymember", "lower_chamber_name"=>"Assembly", "upper_chamber_title"=>"Senator", "terms"=>[#<GovKit::OpenStates::State::Term:0x00000100f2a8e0 @attributes={"....
|
41
|
+
>> x.name
|
42
|
+
=> "California"
|
43
|
+
|
44
|
+
GovKit will raise GovKit::ResourceNotFound if a requested item isn't available.
|
45
|
+
|
46
|
+
# Testing & Debugging
|
47
|
+
|
48
|
+
For debugging purposes, there's a raw_response reader provided for each object, which typically returns an HTTParty::Response object. To see the body of the HTTP response, you might look here:
|
49
|
+
|
50
|
+
(continuing the example from above)
|
51
|
+
>> x.raw_response.response.body
|
52
|
+
=> "{\n \"lower_chamber_title\": \"Assemblymember\", \n \"lower_chamber_name\": \"Assembly\", \n ....
|
53
|
+
|
54
|
+
# Bugs? Questions?
|
55
|
+
|
56
|
+
Please join the [Govkit Google Group](http://groups.google.com/group/govkit), especially if you'd like to talk about a new feature and get announcements.
|
57
|
+
|
58
|
+
[Report a bug](https://participatorypolitics.lighthouseapp.com/projects/51485-govkit) on our Lighthouse page.
|
59
|
+
|
60
|
+
Govkit's main repo is on Github: [http://github.com/opengovernment/govkit](http://github.com/opengovernment/govkit), where your contributions, forks, and feedback are greatly welcomed.
|
61
|
+
|
62
|
+
# Dear Canadians
|
63
|
+
|
64
|
+
For Canadian open government data, our friends up north have created a [govkit-ca](https://github.com/jpmckinney/govkit-ca) gem that lives in the GovKit::CA namespace and should interoperate just fine with this gem.
|
65
|
+
|
66
|
+
# A GovKit for your country?
|
67
|
+
|
68
|
+
Let us know if you'd like to build a govkit for your region! We'd love to link to you. Your gem should be called, for example, govkit-uk (ISO 3166 country code), and your methods should live in the GovKit::GB namespace (for example).
|
69
|
+
|
70
|
+
Copyright (c) 2010 Participatory Politics Foundation, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
rescue LoadError
|
8
|
+
begin
|
9
|
+
gem 'rspec-rails', '>= 2.0.0'
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
rescue LoadError
|
12
|
+
puts "[govkit:] RSpec - or one of it's dependencies - is not available. Install it with: sudo gem install rspec-rails"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
begin
|
17
|
+
require 'jeweler'
|
18
|
+
Jeweler::Tasks.new do |gem|
|
19
|
+
gem.name = "govkit"
|
20
|
+
gem.summary = %Q{Simple access to open government APIs around the web}
|
21
|
+
gem.description = %Q{Govkit lets you quickly get encapsulated Ruby objects for common open government APIs. We're starting with Sunlight's Open States API and the Project Vote Smart API.}
|
22
|
+
gem.email = "develop@opencongress.org"
|
23
|
+
gem.homepage = "http://github.com/opengovernment/govkit"
|
24
|
+
gem.authors = ["Participatory Politics Foundation", "Srinivas Aki", "Carl Tashian"]
|
25
|
+
gem.add_dependency('httparty', '>= 0.7.4')
|
26
|
+
gem.add_dependency('json', '>= 1.4.3')
|
27
|
+
gem.add_dependency('nokogiri', '>= 1.4.4')
|
28
|
+
gem.add_dependency('fastercsv', '>= 1.5.3')
|
29
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
30
|
+
end
|
31
|
+
Jeweler::GemcutterTasks.new
|
32
|
+
rescue LoadError
|
33
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
begin
|
39
|
+
require 'rcov/rcovtask'
|
40
|
+
Rcov::RcovTask.new do |test|
|
41
|
+
test.libs << 'test'
|
42
|
+
test.pattern = 'test/**/test_*.rb'
|
43
|
+
test.verbose = true
|
44
|
+
end
|
45
|
+
rescue LoadError
|
46
|
+
task :rcov do
|
47
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
task :default => :spec
|
52
|
+
|
53
|
+
Rake::RDocTask.new do |rdoc|
|
54
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
55
|
+
|
56
|
+
rdoc.rdoc_dir = 'rdoc'
|
57
|
+
rdoc.title = "govkit #{version}"
|
58
|
+
rdoc.rdoc_files.include('README*')
|
59
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
if defined?(Spec)
|
64
|
+
desc 'Test the govkit plugin.'
|
65
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
66
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
67
|
+
t.spec_opts = ["-c"]
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Test the govkit plugin with specdoc formatting and colors'
|
71
|
+
Spec::Rake::SpecTask.new('specdoc') do |t|
|
72
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
73
|
+
t.spec_opts = ["--format specdoc", "-c"]
|
74
|
+
end
|
75
|
+
|
76
|
+
desc "Run all examples with RCov"
|
77
|
+
Spec::Rake::SpecTask.new('examples_with_rcov') do |t|
|
78
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
79
|
+
t.rcov = true
|
80
|
+
t.rcov_opts = ['--exclude', 'spec,Library']
|
81
|
+
end
|
82
|
+
end
|
data/USAGE
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
See README.markdown for full usage details.
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.7.1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class GovkitGenerator < Rails::Generator::Base
|
2
|
+
|
3
|
+
def initialize(*runtime_args)
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.directory File.join('config', 'initializers')
|
10
|
+
m.template 'govkit.rb', File.join('config', 'initializers', 'govkit.rb')
|
11
|
+
m.directory File.join('app', 'models')
|
12
|
+
m.template 'mention.rb', File.join('app', 'models', 'mention.rb')
|
13
|
+
m.directory File.join('db', 'migrate')
|
14
|
+
m.template 'create_mentions.rb', File.join('db', 'migrate', 'create_mentions.rb')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def banner
|
21
|
+
%{Usage: #{$0} #{spec.name}\nCopies a config initializer to config/initializers/govkit.rb}
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
if defined? GovKit
|
2
|
+
GovKit.configure do |config|
|
3
|
+
# Get an API key for Sunlight's Open States project here:
|
4
|
+
# http://services.sunlightlabs.com/accounts/register/
|
5
|
+
config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY'
|
6
|
+
|
7
|
+
##API key for Votesmart
|
8
|
+
# http://votesmart.org/services_api.php
|
9
|
+
config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
|
10
|
+
|
11
|
+
# API key for NIMSP. Request one here:
|
12
|
+
# http://www.followthemoney.org/membership/settings.phtml
|
13
|
+
config.ftm_apikey = 'YOUR_FTM_API_KEY'
|
14
|
+
|
15
|
+
# Technorati API key
|
16
|
+
# config.technorati_apikey = 'YOUR_TECHNORATI_APIKEY'
|
17
|
+
|
18
|
+
# Bing App ID
|
19
|
+
config.bing_appid = 'YOUR_BING_APPID'
|
20
|
+
|
21
|
+
# Other things you could set here include alternate URLs for
|
22
|
+
# the APIs. See GovKit::Configuration for available attributes.
|
23
|
+
end
|
24
|
+
end
|
data/govkit.gemspec
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{govkit-h}
|
8
|
+
s.version = "0.7.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Participatory Politics Foundation", "Srinivas Aki", "Carl Tashian"]
|
12
|
+
s.date = %q{2011-06-30}
|
13
|
+
s.description = %q{Govkit lets you quickly get encapsulated Ruby objects for common open government APIs. We're starting with Sunlight's Open States API and the Project Vote Smart API.}
|
14
|
+
s.email = %q{develop@opencongress.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"LICENSE",
|
24
|
+
"README.md",
|
25
|
+
"Rakefile",
|
26
|
+
"USAGE",
|
27
|
+
"VERSION",
|
28
|
+
"generators/govkit/govkit_generator.rb",
|
29
|
+
"generators/govkit/templates/govkit.rb",
|
30
|
+
"govkit.gemspec",
|
31
|
+
"init.rb",
|
32
|
+
"lib/generators/govkit/govkit_generator.rb",
|
33
|
+
"lib/generators/govkit/templates/govkit.rb",
|
34
|
+
"lib/generators/govkit/templates/mention.rb",
|
35
|
+
"lib/generators/govkit/templates/create_mentions.rb",
|
36
|
+
"lib/gov_kit.rb",
|
37
|
+
"lib/gov_kit/acts_as_noteworthy.rb",
|
38
|
+
"lib/gov_kit/configuration.rb",
|
39
|
+
"lib/gov_kit/follow_the_money.rb",
|
40
|
+
"lib/gov_kit/open_congress.rb",
|
41
|
+
"lib/gov_kit/open_congress/bill.rb",
|
42
|
+
"lib/gov_kit/open_congress/blog_post.rb",
|
43
|
+
"lib/gov_kit/open_congress/news_post.rb",
|
44
|
+
"lib/gov_kit/open_congress/person.rb",
|
45
|
+
"lib/gov_kit/open_congress/person_stat.rb",
|
46
|
+
"lib/gov_kit/open_congress/roll_call.rb",
|
47
|
+
"lib/gov_kit/open_congress/roll_call_comparison.rb",
|
48
|
+
"lib/gov_kit/open_congress/voting_comparison.rb",
|
49
|
+
"lib/gov_kit/open_states.rb",
|
50
|
+
"lib/gov_kit/railtie.rb",
|
51
|
+
"lib/gov_kit/resource.rb",
|
52
|
+
"lib/gov_kit/search_engines.rb",
|
53
|
+
"lib/gov_kit/search_engines/bing.rb",
|
54
|
+
"lib/gov_kit/search_engines/google_blog.rb",
|
55
|
+
"lib/gov_kit/search_engines/google_news.rb",
|
56
|
+
"lib/gov_kit/search_engines/technorati.rb",
|
57
|
+
"lib/gov_kit/search_engines/wikipedia.rb",
|
58
|
+
"lib/gov_kit/transparency_data.rb",
|
59
|
+
"lib/gov_kit/vote_smart.rb",
|
60
|
+
"lib/govkit.rb",
|
61
|
+
"spec/fixtures/bing/news_search.response",
|
62
|
+
"spec/fixtures/bing/no_results.response",
|
63
|
+
"spec/fixtures/follow_the_money/business-page0.response",
|
64
|
+
"spec/fixtures/follow_the_money/business-page1.response",
|
65
|
+
"spec/fixtures/follow_the_money/contribution.response",
|
66
|
+
"spec/fixtures/follow_the_money/unauthorized.response",
|
67
|
+
"spec/fixtures/open_congress/person.response",
|
68
|
+
"spec/fixtures/open_states/401.response",
|
69
|
+
"spec/fixtures/open_states/404.response",
|
70
|
+
"spec/fixtures/open_states/410.response",
|
71
|
+
"spec/fixtures/open_states/bill.response",
|
72
|
+
"spec/fixtures/open_states/bill_query.response",
|
73
|
+
"spec/fixtures/open_states/committee_find.response",
|
74
|
+
"spec/fixtures/open_states/committee_query.response",
|
75
|
+
"spec/fixtures/open_states/legislator.response",
|
76
|
+
"spec/fixtures/open_states/legislator_query.response",
|
77
|
+
"spec/fixtures/open_states/state.response",
|
78
|
+
"spec/fixtures/search_engines/google_news.response",
|
79
|
+
"spec/fixtures/transparency_data/contributions.response",
|
80
|
+
"spec/fixtures/transparency_data/entities_search.response",
|
81
|
+
"spec/fixtures/transparency_data/entities_search_limit_0.response",
|
82
|
+
"spec/fixtures/transparency_data/entities_search_limit_1.response",
|
83
|
+
"spec/fixtures/transparency_data/grants_find_all.response",
|
84
|
+
"spec/fixtures/transparency_data/lobbyists_find_all.response",
|
85
|
+
"spec/follow_the_money_spec.rb",
|
86
|
+
"spec/open_congress_spec.rb",
|
87
|
+
"spec/open_states_spec.rb",
|
88
|
+
"spec/search_engines_spec.rb",
|
89
|
+
"spec/spec_helper.rb",
|
90
|
+
"spec/transparency_data_spec.rb"
|
91
|
+
]
|
92
|
+
s.homepage = %q{http://github.com/opengovernment/govkit}
|
93
|
+
s.require_paths = ["lib"]
|
94
|
+
s.rubygems_version = %q{1.6.2}
|
95
|
+
s.summary = %q{Simple access to open government APIs around the web}
|
96
|
+
|
97
|
+
if s.respond_to? :specification_version then
|
98
|
+
s.specification_version = 3
|
99
|
+
|
100
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
101
|
+
s.add_runtime_dependency(%q<active_support>, [">= 0"])
|
102
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
103
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
104
|
+
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
105
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0.7.4"])
|
106
|
+
s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
|
107
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.4.4"])
|
108
|
+
s.add_runtime_dependency(%q<fastercsv>, [">= 1.5.3"])
|
109
|
+
else
|
110
|
+
s.add_dependency(%q<active_support>, [">= 0"])
|
111
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
112
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
113
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
114
|
+
s.add_dependency(%q<httparty>, [">= 0.7.4"])
|
115
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
116
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
117
|
+
s.add_dependency(%q<fastercsv>, [">= 1.5.3"])
|
118
|
+
end
|
119
|
+
else
|
120
|
+
s.add_dependency(%q<active_support>, [">= 0"])
|
121
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
122
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
123
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
124
|
+
s.add_dependency(%q<httparty>, [">= 0.7.4"])
|
125
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
126
|
+
s.add_dependency(%q<nokogiri>, [">= 1.4.4"])
|
127
|
+
s.add_dependency(%q<fastercsv>, [">= 1.5.3"])
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
data/init.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
# Generator to setup rails app for using GovKit
|
4
|
+
class GovkitGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
def initialize(*runtime_args)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "Copies files necessary to use govkit"
|
11
|
+
|
12
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
13
|
+
|
14
|
+
# Copies the files necessary to use govkit (initializer, migrations, and models)
|
15
|
+
def copy_initializer_file
|
16
|
+
copy_file 'govkit.rb', File.join('config', 'initializers', 'govkit.rb')
|
17
|
+
copy_file 'mention.rb', File.join('app', 'models', 'mention.rb')
|
18
|
+
copy_file 'create_mentions.rb', File.join('db', 'migrate', "#{ Time.now.utc.strftime "%Y%m%d%H%M%S" }create_mentions.rb")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateMentions < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :mentions, :force => true do |t|
|
4
|
+
t.string "url", :limit => 8000
|
5
|
+
t.string "excerpt", :limit => 4000
|
6
|
+
t.string "title", :limit => 1000
|
7
|
+
t.string "source"
|
8
|
+
t.datetime "date"
|
9
|
+
t.float "weight"
|
10
|
+
t.integer "owner_id"
|
11
|
+
t.string "owner_type"
|
12
|
+
t.string "search_source"
|
13
|
+
t.datetime "created_at"
|
14
|
+
t.datetime "updated_at"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :mentions
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
if defined? GovKit
|
2
|
+
GovKit.configure do |config|
|
3
|
+
# Get an API key for Sunlight's Open States project here:
|
4
|
+
# http://services.sunlightlabs.com/accounts/register/
|
5
|
+
config.sunlight_apikey = 'YOUR_SUNLIGHT_API_KEY'
|
6
|
+
|
7
|
+
##API key for Votesmart
|
8
|
+
# http://votesmart.org/services_api.php
|
9
|
+
config.votesmart_apikey = 'YOUR_VOTESMART_API_KEY'
|
10
|
+
|
11
|
+
# API key for NIMSP. Request one here:
|
12
|
+
# http://www.followthemoney.org/membership/settings.phtml
|
13
|
+
config.ftm_apikey = 'YOUR_FTM_API_KEY'
|
14
|
+
|
15
|
+
# Technorati API key
|
16
|
+
# config.technorati_apikey = 'YOUR_TECHNORATI_APIKEY'
|
17
|
+
|
18
|
+
# Bing App ID
|
19
|
+
config.bing_appid = 'YOUR_BING_APPID'
|
20
|
+
|
21
|
+
# Other things you could set here include alternate URLs for
|
22
|
+
# the APIs. See GovKit::Configuration for available attributes.
|
23
|
+
end
|
24
|
+
end
|