govkit 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
data/govkit.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{govkit}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Participatory Politics Foundation", "Srinivas Aki", "Carl Tashian"]
@@ -15,5 +15,11 @@ if defined? GovKit
15
15
  # Api key for OpenCongress
16
16
  # http://www.opencongress.org/api
17
17
  config.opencongress_apikey = 'YOUR_OPENCONGRESS_API_KEY'
18
+
19
+ # Technorati API key
20
+ config.technorati_apikey = 'YOUR_TECHNORATI_APIKEY'
21
+
22
+ # Other things you could set here include alternate URLs for
23
+ # the APIs. See GovKit::Configuration for available attributes.
18
24
  end
19
25
  end
@@ -4,6 +4,9 @@ module GovKit
4
4
  attr_accessor :votesmart_apikey, :votesmart_base_url
5
5
  attr_accessor :ftm_apikey, :ftm_base_url
6
6
  attr_accessor :opencongress_apikey, :opencongress_base_url
7
+ attr_accessor :technorati_apikey, :technorati_base_url
8
+ attr_accessor :google_blog_base_url, :google_news_base_url
9
+ attr_accessor :wikipedia_base_url
7
10
 
8
11
  def initialize
9
12
  @openstates_apikey = @votesmart_apikey = @ftm_apikey = ''
@@ -11,6 +14,10 @@ module GovKit
11
14
  @votesmart_base_url = 'api.votesmart.org/'
12
15
  @ftm_base_url = 'api.followthemoney.org/'
13
16
  @opencongress_base_url = 'www.opencongress.org/'
17
+ @technorati_base_url = 'api.technorati.com'
18
+ @google_blog_base_url = 'blogsearch.google.com'
19
+ @google_news_base_url = 'news.google.com'
20
+ @wikipedia_base_url = 'en.wikipedia.org'
14
21
  end
15
22
  end
16
23
 
@@ -3,7 +3,7 @@ module GovKit
3
3
  class GoogleBlog
4
4
  def self.search(options=[])
5
5
  query = options.join('+')
6
- host = "blogsearch.google.com"
6
+ host = GovKit::configuration.google_blog_base_url
7
7
  path = "/blogsearch?hl=en&q=#{URI::encode(query)}&btnG=Search+Blogs&num=50"
8
8
 
9
9
  html = make_request(host, path)
@@ -6,7 +6,7 @@ module GovKit
6
6
  class GoogleNews
7
7
  def self.search(options=[])
8
8
  query = options.join('+')
9
- host = "news.google.com"
9
+ host = GovKit::configuration.google_news_base_url
10
10
  path = "/news?hl=en&ned=us&q=#{URI::encode(query)}&btnG=Search+News&num=50"
11
11
 
12
12
  html = make_request(host, path)
@@ -3,8 +3,8 @@ module GovKit
3
3
  class Technorati
4
4
  def self.search(options=[])
5
5
  query = options.to_query('q')
6
- host = "api.technorati.com"
7
- path = "/search?key=#{API_KEYS["technorati_api_key"]}&limit=50&language=en&query=#{URI::encode(query)}"
6
+ host = GovKit::configuration.technorati_base_url
7
+ path = "/search?key=#{GovKit::configuration.technorati_apikey}&limit=50&language=en&query=#{URI::encode(query)}"
8
8
 
9
9
  html = make_request(host, path)
10
10
  doc = Hpricot(Iconv.conv('utf-8//IGNORE', 'gb2312',html))
@@ -3,8 +3,8 @@ module GovKit
3
3
  class Wikipedia
4
4
  include HTTParty
5
5
  default_params :format => 'xml'
6
- base_uri "en.wikipedia.org"
7
- headers 'User-Agent' => 'GovKit +http://opengovernment.org'
6
+ base_uri GovKit::configuration.wikipedia_base_url
7
+ headers 'User-Agent' => 'GovKit +http://ppolitics.org'
8
8
 
9
9
  def self.search(query, options={})
10
10
  response = get("/wiki/#{query}")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Participatory Politics Foundation