statement 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Statement
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
data/lib/statement.rb CHANGED
@@ -65,7 +65,7 @@ module Statement
65
65
  def self.from_scrapers
66
66
  year = Date.today.year
67
67
  [freshman_senators, capuano, cold_fusion(year, 0), conaway, susandavis, faleomavaega, klobuchar, lujan, palazzo(page=1), billnelson(year=year),
68
- document_query(page=1), document_query(page=2), lautenberg, crapo, coburn, boxer(start=1), mccain(year=year),
68
+ document_query(page=1), document_query(page=2), donnelly(year=year), lautenberg, crapo, coburn, boxer(start=1), mccain(year=year),
69
69
  vitter_cowan(year=year), inhofe(year=year), reid].flatten
70
70
  end
71
71
 
@@ -159,9 +159,10 @@ module Statement
159
159
 
160
160
  def self.freshman_senators
161
161
  results = []
162
- ['baldwin', 'donnelly', 'flake', 'hirono','heinrich','murphy','scott','king','heitkamp','cruz','kaine'].each do |senator|
162
+ ['baldwin', 'flake', 'hirono','heinrich','murphy','scott','king','heitkamp','cruz','kaine'].each do |senator|
163
+ puts senator
163
164
  base_url = "http://www.#{senator}.senate.gov/"
164
- doc = open_html(base_url+'press.cfm?maxrows=200&startrow=1&&type=1')
165
+ doc = Statement::Link.open_html(base_url+'press.cfm?maxrows=200&startrow=1&&type=1')
165
166
  return if doc.nil?
166
167
  doc.xpath("//tr")[3..-1].each do |row|
167
168
  next if row.text.strip == ''
@@ -270,12 +271,16 @@ module Statement
270
271
  results
271
272
  end
272
273
 
273
- def self.vitter_cowan(year=Date.today.year)
274
+ def self.vitter_cowan_donnelly(year=Date.today.year)
274
275
  results = []
275
276
  urls = ["http://www.vitter.senate.gov/newsroom/", "http://www.cowan.senate.gov/"]
276
277
  urls.each do |url|
277
278
  next if year < 2013 and url == "http://www.cowan.senate.gov/"
278
- domain = url == "http://www.vitter.senate.gov/newsroom/" ? "www.vitter.senate.gov" : "www.cowan.senate.gov"
279
+ if url == "http://www.vitter.senate.gov/newsroom/"
280
+ domain = "www.vitter.senate.gov"
281
+ elsif url == "http://www.cowan.senate.gov/"
282
+ domain = "www.cowan.senate.gov"
283
+ end
279
284
  doc = open_html(url+"press?year=#{year}")
280
285
  return if doc.nil?
281
286
  doc.xpath("//tr")[1..-1].each do |row|
@@ -286,6 +291,19 @@ module Statement
286
291
  results.flatten
287
292
  end
288
293
 
294
+ def self.donnelly(year=Date.today.year)
295
+ results = []
296
+ url = "http://www.donnelly.senate.gov/newsroom/press?year=2013"
297
+ domain = "www.donnelly.senate.gov"
298
+ doc = open_html(url+"press?year=#{year}")
299
+ return if doc.nil?
300
+ doc.xpath("//tr")[1..-1].each do |row|
301
+ next if row.text.strip.size < 30
302
+ results << { :source => url, :url => "http://www.donnelly.senate.gov"+row.children[2].children[1]['href'].strip, :title => row.children[2].text.strip, :date => Date.parse(row.children[0].text), :domain => domain}
303
+ end
304
+ results
305
+ end
306
+
289
307
  def self.inhofe(year=Date.today.year)
290
308
  results = []
291
309
  url = "http://www.inhofe.senate.gov/newsroom/press-releases?year=#{year}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statement
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -129,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  segments:
131
131
  - 0
132
- hash: 2838603504965451110
132
+ hash: 719456909496080743
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  none: false
135
135
  requirements:
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  segments:
140
140
  - 0
141
- hash: 2838603504965451110
141
+ hash: 719456909496080743
142
142
  requirements: []
143
143
  rubyforge_project:
144
144
  rubygems_version: 1.8.24