statement 0.6 → 0.7

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.
@@ -1,3 +1,3 @@
1
1
  module Statement
2
- VERSION = "0.6"
2
+ VERSION = "0.7"
3
3
  end
data/lib/statement.rb CHANGED
@@ -10,26 +10,53 @@ module Statement
10
10
  class Link
11
11
  def self.absolute_link(url, link)
12
12
  return link if link =~ /^http:\/\//
13
-
14
- (URI.parse(url) + link).to_s
13
+ ("http://"+URI.parse(url).host + "/"+link).to_s
14
+ end
15
+
16
+ def self.open_rss(url)
17
+ begin
18
+ Nokogiri::XML(open(url))
19
+ rescue
20
+ nil
21
+ end
22
+ end
23
+
24
+ def self.open_html(url)
25
+ begin
26
+ Nokogiri::HTML(open(url).read)
27
+ rescue
28
+ nil
29
+ end
30
+ end
31
+
32
+ def self.date_from_rss_item(link)
33
+ if !link.xpath('pubDate').empty?
34
+ Date.parse(link.xpath('pubDate').text)
35
+ elsif !link.xpath('pubdate').empty?
36
+ Date.parse(link.xpath('pubdate').text)
37
+ else
38
+ nil
39
+ end
15
40
  end
16
41
 
17
42
  def self.from_rss(url)
18
- doc = Nokogiri::XML(open(url))
43
+ doc = open_rss(url)
44
+ return unless doc
19
45
  links = doc.xpath('//item')
20
- links.map do |link|
46
+ links.map do |link|
21
47
  abs_link = absolute_link(url, link.xpath('link').text)
22
- { :source => url, :url => abs_link, :title => link.xpath('title').text, :date => link.xpath('pubDate').empty? ? nil: Date.parse(link.xpath('pubDate').text), :domain => URI.parse(link.xpath('link').text).host }
48
+ abs_link = "http://www.burr.senate.gov/public/"+ link.xpath('link').text if url == 'http://www.burr.senate.gov/public/index.cfm?FuseAction=RSS.Feed'
49
+ { :source => url, :url => abs_link, :title => link.xpath('title').text, :date => date_from_rss_item(link), :domain => URI.parse(url).host }
23
50
  end
24
51
  end
25
52
 
26
53
  def self.house_gop(url)
54
+ doc = open_html(url)
55
+ return unless doc
27
56
  uri = URI.parse(url)
28
57
  date = Date.parse(uri.query.split('=').last)
29
- doc = Nokogiri::HTML(open(url).read)
30
58
  links = doc.xpath("//ul[@id='membernews']").search('a')
31
59
  links.map do |link|
32
- # return a hash
33
60
  abs_link = absolute_link(url, link["href"])
34
61
  { :source => url, :url => abs_link, :title => link.text.strip, :date => date, :domain => URI.parse(link["href"]).host }
35
62
  end
@@ -55,7 +82,8 @@ module Statement
55
82
  results = []
56
83
  base_url = "http://www.house.gov/capuano/news/"
57
84
  list_url = base_url + 'date.shtml'
58
- doc = Nokogiri::HTML(open(list_url).read)
85
+ doc = open_html(list_url)
86
+ return if doc.nil?
59
87
  doc.xpath("//a").each do |link|
60
88
  if link['href'] and link['href'].include?('/pr')
61
89
  begin
@@ -82,7 +110,8 @@ module Statement
82
110
  else
83
111
  url = "http://"+domain + "index.cfm/press-releases?YearDisplay=#{year}&MonthDisplay=#{month}&page=1"
84
112
  end
85
- doc = Nokogiri::HTML(open(url).read)
113
+ doc = open_html(url)
114
+ return if doc.nil?
86
115
  doc.xpath("//tr")[2..-1].each do |row|
87
116
  date_text, title = row.children.map{|c| c.text.strip}.reject{|c| c.empty?}
88
117
  next if date_text == 'Date' or date_text.size > 8
@@ -97,7 +126,8 @@ module Statement
97
126
  results = []
98
127
  base_url = "http://conaway.house.gov/news/"
99
128
  page_url = base_url + "documentquery.aspx?DocumentTypeID=1279&Page=#{page}"
100
- doc = Nokogiri::HTML(open(page_url).read)
129
+ doc = open_html(page_url)
130
+ return if doc.nil?
101
131
  doc.xpath("//tr")[1..-1].each do |row|
102
132
  results << { :source => page_url, :url => base_url + row.children.children[1]['href'], :title => row.children.children[1].text.strip, :date => Date.parse(row.children.children[4].text), :domain => "conaway.house.gov" }
103
133
  end
@@ -107,7 +137,8 @@ module Statement
107
137
  def self.susandavis
108
138
  results = []
109
139
  base_url = "http://www.house.gov/susandavis/"
110
- doc = Nokogiri::HTML(open(base_url+'news.shtml').read)
140
+ doc = open_html(base_url+'news.shtml')
141
+ return if doc.nil?
111
142
  doc.search("ul")[6].children.each do |row|
112
143
  next if row.text.strip == ''
113
144
  results << { :source => base_url+'news.shtml', :url => base_url + row.children[1]['href'], :title => row.children[1].text.split.join(' '), :date => Date.parse(row.children.first.text), :domain => "house.gov/susandavis" }
@@ -118,7 +149,8 @@ module Statement
118
149
  def self.faleomavaega
119
150
  results = []
120
151
  base_url = "http://www.house.gov/faleomavaega/news-press.shtml"
121
- doc = Nokogiri::HTML(open(base_url).read)
152
+ doc = open_html(base_url)
153
+ return if doc.nil?
122
154
  doc.xpath("//li[@type='disc']").each do |row|
123
155
  results << { :source => base_url, :url => "http://www.house.gov/" + row.children[0]['href'], :title => row.children[0].text.gsub(/[u201cu201d]/, '').split('Washington, D.C.').last, :date => Date.parse(row.children[1].text), :domain => "house.gov/faleomavaega" }
124
156
  end
@@ -129,7 +161,8 @@ module Statement
129
161
  results = []
130
162
  ['baldwin', 'donnelly', 'flake', 'hirono','heinrich','murphy','scott','king','heitkamp','cruz','kaine'].each do |senator|
131
163
  base_url = "http://www.#{senator}.senate.gov/"
132
- doc = Nokogiri::HTML(open(base_url+'press.cfm?maxrows=200&startrow=1&&type=1').read)
164
+ doc = open_html(base_url+'press.cfm?maxrows=200&startrow=1&&type=1')
165
+ return if doc.nil?
133
166
  doc.xpath("//tr")[3..-1].each do |row|
134
167
  next if row.text.strip == ''
135
168
  results << { :source => base_url+'press.cfm?maxrows=200&startrow=1&&type=1', :url => base_url + row.children.children[1]['href'], :title => row.children.children[1].text.strip.split.join(' '), :date => Date.parse(row.children.children[0].text), :domain => "#{senator}.senate.gov" }
@@ -143,7 +176,8 @@ module Statement
143
176
  base_url = "http://www.klobuchar.senate.gov/"
144
177
  [2012,2013].each do |year|
145
178
  year_url = base_url + "newsreleases.cfm?year=#{year}"
146
- doc = Nokogiri::HTML(open(year_url).read)
179
+ doc = open_html(year_url)
180
+ return if doc.nil?
147
181
  doc.xpath("//dt").each do |row|
148
182
  results << { :source => year_url, :url => base_url + row.next.children[0]['href'], :title => row.next.text.strip.gsub(/[u201cu201d]/, '').split.join(' '), :date => Date.parse(row.text), :domain => "klobuchar.senate.gov" }
149
183
  end
@@ -154,7 +188,8 @@ module Statement
154
188
  def self.lujan
155
189
  results = []
156
190
  base_url = 'http://lujan.house.gov/'
157
- doc = Nokogiri::HTML(open(base_url+'index.php?option=com_content&view=article&id=981&Itemid=78').read)
191
+ doc = open_html(base_url+'index.php?option=com_content&view=article&id=981&Itemid=78')
192
+ return if doc.nil?
158
193
  doc.xpath('//ul')[1].children.each do |row|
159
194
  next if row.text.strip == ''
160
195
  results << { :source => base_url+'index.php?option=com_content&view=article&id=981&Itemid=78', :url => base_url + row.children[0]['href'], :title => row.children[0].text, :date => nil, :domain => "lujan.house.gov" }
@@ -166,7 +201,8 @@ module Statement
166
201
  results = []
167
202
  base_url = "http://www.billnelson.senate.gov/news/"
168
203
  year_url = base_url + "media.cfm?year=#{year}"
169
- doc = Nokogiri::HTML(open(year_url).read)
204
+ doc = open_html(year_url)
205
+ return if doc.nil?
170
206
  doc.xpath('//li').each do |row|
171
207
  results << { :source => year_url, :url => base_url + row.children[0]['href'], :title => row.children[0].text.strip, :date => Date.parse(row.children.last.text), :domain => "billnelson.senate.gov" }
172
208
  end
@@ -178,7 +214,8 @@ module Statement
178
214
  results = []
179
215
  base_url = 'http://www.lautenberg.senate.gov/newsroom/'
180
216
  url = base_url + "releases.cfm?maxrows=#{rows}&startrow=1&&type=1"
181
- doc = Nokogiri::HTML(open(url).read)
217
+ doc = open_html(url)
218
+ return if doc.nil?
182
219
  doc.xpath("//tr")[4..-2].each do |row|
183
220
  results << { :source => url, :url => base_url + row.children[2].children[0]['href'], :title => row.children[2].text.strip, :date => Date.parse(row.children[0].text.strip), :domain => "lautenberg.senate.gov" }
184
221
  end
@@ -189,7 +226,8 @@ module Statement
189
226
  results = []
190
227
  base_url = "http://www.crapo.senate.gov/media/newsreleases/"
191
228
  url = base_url + "release_all.cfm"
192
- doc = Nokogiri::HTML(open(url).read)
229
+ doc = open_html(url)
230
+ return if doc.nil?
193
231
  doc.xpath("//tr").each do |row|
194
232
  results << { :source => url, :url => base_url + row.children[2].children[0]['href'], :title => row.children[2].text.strip, :date => Date.parse(row.children[0].text.strip.gsub('-','/')), :domain => "crapo.senate.gov" }
195
233
  end
@@ -199,7 +237,8 @@ module Statement
199
237
  def self.coburn(year=Date.today.year)
200
238
  results = []
201
239
  url = "http://www.coburn.senate.gov/public/index.cfm?p=PressReleases&ContentType_id=d741b7a7-7863-4223-9904-8cb9378aa03a&Group_id=7a55cb96-4639-4dac-8c0c-99a4a227bd3a&MonthDisplay=0&YearDisplay=#{year}"
202
- doc = Nokogiri::HTML(open(url).read)
240
+ doc = open_html(url)
241
+ return if doc.nil?
203
242
  doc.xpath("//tr")[2..-1].each do |row|
204
243
  next if row.text[0..3] == "Date"
205
244
  results << { :source => url, :url => row.children[2].children[0]['href'], :title => row.children[2].text.strip, :date => Date.parse(row.children[0].text.strip), :domain => "coburn.senate.gov" }
@@ -211,7 +250,8 @@ module Statement
211
250
  results = []
212
251
  url = "http://www.boxer.senate.gov/en/press/releases.cfm?start=#{start}"
213
252
  domain = 'www.boxer.senate.gov'
214
- doc = Nokogiri::HTML(open(url).read)
253
+ doc = open_html(url)
254
+ return if doc.nil?
215
255
  doc.xpath("//div[@class='left']")[1..-1].each do |row|
216
256
  results << { :source => url, :url => domain + row.next.next.children[1].children[0]['href'], :title => row.next.next.children[1].children[0].text, :date => Date.parse(row.text.strip), :domain => domain}
217
257
  end
@@ -222,7 +262,8 @@ module Statement
222
262
  results = []
223
263
  url = "http://www.mccain.senate.gov/public/index.cfm?FuseAction=PressOffice.PressReleases&ContentRecordType_id=75e7e4a0-6088-44b6-8061-089d80513dc4&Region_id=&Issue_id=&MonthDisplay=0&YearDisplay=#{year}"
224
264
  domain = 'www.mccain.senate.gov'
225
- doc = Nokogiri::HTML(open(url).read)
265
+ doc = open_html(url)
266
+ return if doc.nil?
226
267
  doc.xpath("//li")[7..-1].each do |row|
227
268
  results << { :source => url, :url => domain + row.children[3].children[1].children[4].children[0]['href'], :title => row.children[3].children[1].children[4].text, :date => Date.parse(row.children[3].children[1].children[0].text), :domain => domain}
228
269
  end
@@ -235,7 +276,8 @@ module Statement
235
276
  urls.each do |url|
236
277
  next if year < 2013 and url == "http://www.cowan.senate.gov/"
237
278
  domain = url == "http://www.vitter.senate.gov/newsroom/" ? "www.vitter.senate.gov" : "www.cowan.senate.gov"
238
- doc = Nokogiri::HTML(open(url+"press?year=#{year}").read)
279
+ doc = open_html(url+"press?year=#{year}")
280
+ return if doc.nil?
239
281
  doc.xpath("//tr")[1..-1].each do |row|
240
282
  next if row.text.strip.size < 30
241
283
  results << { :source => url, :url => row.children[2].children[0]['href'].strip, :title => row.children[2].text, :date => Date.parse(row.children[0].text), :domain => domain}
@@ -248,7 +290,8 @@ module Statement
248
290
  results = []
249
291
  url = "http://www.inhofe.senate.gov/newsroom/press-releases?year=#{year}"
250
292
  domain = "www.inhofe.senate.gov"
251
- doc = Nokogiri::HTML(open(url).read)
293
+ doc = open_html(url)
294
+ return if doc.nil?
252
295
  doc.xpath("//tr")[1..-1].each do |row|
253
296
  results << { :source => url, :url => row.children[2].children[0]['href'].strip, :title => row.children[2].text, :date => Date.parse(row.children[0].text), :domain => domain}
254
297
  end
@@ -259,7 +302,8 @@ module Statement
259
302
  results = []
260
303
  url = "http://www.levin.senate.gov/newsroom/index.cfm?PageNum_rs=#{page}&section=press"
261
304
  domain = "www.levin.senate.gov"
262
- doc = Nokogiri::HTML(open(url).read)
305
+ doc = open_html(url)
306
+ return if doc.nil?
263
307
  doc.xpath('//tr').each do |row|
264
308
  results << { :source => url, :url => row.children[2].children[0]['href'].gsub(/\s+/, ""), :title => row.children[2].children[0].text, :date => Date.parse(row.children[0].text), :domain => domain}
265
309
  end
@@ -270,7 +314,8 @@ module Statement
270
314
  results = []
271
315
  url = "http://www.reid.senate.gov/newsroom/press_releases.cfm"
272
316
  domain = "www.reid.senate.gov"
273
- doc = Nokogiri::HTML(open(url).read)
317
+ doc = open_html(url)
318
+ return if doc.nil?
274
319
  doc.xpath("//table[@id='CS_PgIndex_21891_21893']//tr")[1..-1].each do |row|
275
320
  results << { :source => url, :url => "http://www.reid.senate.gov"+row.children[0].children[0]['href'], :title => row.children[0].children[0].text, :date => Date.parse(row.children[0].children[2].text), :domain => domain}
276
321
  end
@@ -281,7 +326,8 @@ module Statement
281
326
  results = []
282
327
  domains = [{"roe.house.gov" => 1532}, {"thornberry.house.gov" => 1776}, {"wenstrup.house.gov" => 2491}]
283
328
  domains.each do |domain|
284
- doc = Nokogiri::HTML(open("http://"+domain.keys.first+"/news/documentquery.aspx?DocumentTypeID=#{domain.values.first}&Page=#{page}").read)
329
+ doc = open_html("http://"+domain.keys.first+"/news/documentquery.aspx?DocumentTypeID=#{domain.values.first}&Page=#{page}")
330
+ return if doc.nil?
285
331
  doc.xpath("//span[@class='middlecopy']").each do |row|
286
332
  results << { :source => "http://"+domain.keys.first+"/news/"+"documentquery.aspx?DocumentTypeID=#{domain.values.first}&Page=#{page}", :url => "http://"+domain.keys.first+"/news/" + row.children[6]['href'], :title => row.children[1].text.strip, :date => Date.parse(row.children[4].text.strip), :domain => domain.keys.first }
287
333
  end
@@ -159,7 +159,7 @@
159
159
  </a>
160
160
  </li>
161
161
  <li>
162
- <a href="other/relative_url_test.html" target="_blank">
162
+ <a href="republicans/other/relative_url_test.html" target="_blank">
163
163
  <img src="/resources/images/contact/members/113/WA/04x60.jpg" border="0" alt="" width="40" style="float: left; margin-right: 10px;" />
164
164
  Relative URL test
165
165
  </a>
@@ -0,0 +1,196 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <rss version="2.0">
3
+ <channel>
4
+ <title>Richard Burr, United States Senator of North Carolina</title>
5
+ <link>http://www.burr.senate.gov/public/</link>
6
+ <description>A collection of the posts to Richard Burr, United States Senator of North Carolina's website.</description>
7
+ <!--
8
+ <image>
9
+ <title>Richard Burr, United States Senator of North Carolina</title>
10
+ <link>http://www.burr.senate.gov/public/</link>
11
+ <url>http://www.burr.senate.gov/public/_images/rss_banner.gif</url>
12
+ </image>
13
+ -->
14
+ <docs>index.cfm?FuseAction=RSS.About</docs>
15
+ <generator>SiteDirector || www.gslsolutions.com</generator>
16
+ <language>en-us</language>
17
+ <lastbuilddate>Tue, 07 May 2013 12:45:39 EST</lastbuilddate>
18
+ <webmaster>support@gslsolutions.com</webmaster>
19
+
20
+ <item>
21
+ <title>Senator Burr Congratulates Rep. Mel Watt On His Nomination As FHFA Director</title>
22
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=65dbea38-d64c-6208-ef8f-2b000e899b3a</link>
23
+ <category>Press Release</category>
24
+ <pubdate>Thu, 02 May 2013 11:27:00 EST</pubdate>
25
+ </item>
26
+
27
+ <item>
28
+ <title>Senator Burr Congratulates Charlotte Mayor Anthony Foxx On His Nomination As Transportation Secretary</title>
29
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=5712e00a-cd2a-0e38-9b57-90e9b9d2bc2e</link>
30
+ <category>Press Release</category>
31
+ <pubdate>Mon, 29 Apr 2013 02:32:00 EST</pubdate>
32
+ </item>
33
+
34
+ <item>
35
+ <title>Sanders, Burr Propose Legislation for Homeless Veterans </title>
36
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=42cf2199-f221-d2e6-4b48-945212c16f6c</link>
37
+ <category>Press Release</category>
38
+ <pubdate>Thu, 25 Apr 2013 04:03:00 EST</pubdate>
39
+ </item>
40
+
41
+ <item>
42
+ <title>Senator Burr Statement on Constituent Mailing Operations </title>
43
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=3da93329-977f-867f-8b83-28c2ab5f4f50</link>
44
+ <category>Press Release</category>
45
+ <pubdate>Wed, 24 Apr 2013 04:05:00 EST</pubdate>
46
+ </item>
47
+
48
+ <item>
49
+ <title>Burr, Coburn, Thune Introduce Public Employee Pension Transparency Act</title>
50
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=38458726-b8d6-0e8c-b1d4-935b9ffe0b9b</link>
51
+ <category>Press Release</category>
52
+ <pubdate>Tue, 23 Apr 2013 02:58:00 EST</pubdate>
53
+ </item>
54
+
55
+ <item>
56
+ <title>Senator Burr Announces Opposition to Manchin-Toomey Amendment</title>
57
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=13190e4a-ecf0-4e63-65f9-dc6878152437</link>
58
+ <category>Press Release</category>
59
+ <pubdate>Tue, 16 Apr 2013 09:45:00 EST</pubdate>
60
+ </item>
61
+
62
+ <item>
63
+ <title>The President's Budget</title>
64
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=f9a8d43b-998f-e827-0106-27170d45b646</link>
65
+ <category>Blog</category>
66
+ <pubdate>Thu, 11 Apr 2013 11:00:00 EST</pubdate>
67
+ </item>
68
+
69
+ <item>
70
+ <title>Senator Burr Votes Against Irresponsible Senate Budget</title>
71
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=97794cc5-ae48-edc6-1636-6d6cb2ba2907</link>
72
+ <category>Press Release</category>
73
+ <pubdate>Sat, 23 Mar 2013 09:37:00 EST</pubdate>
74
+ </item>
75
+
76
+ <item>
77
+ <title>Senator Burr Introduces Child Care Protection Act of 2013 </title>
78
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=897e43f5-98e9-9fe5-5997-e48fd6da7ad5</link>
79
+ <category>Press Release</category>
80
+ <pubdate>Wed, 20 Mar 2013 04:13:00 EST</pubdate>
81
+ </item>
82
+
83
+ <item>
84
+ <title>Senator Burr Introduces Veterans Second Amendment Protection Act</title>
85
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=6a68a29a-d82c-d395-729d-3490338689eb</link>
86
+ <category>Press Release</category>
87
+ <pubdate>Thu, 14 Mar 2013 03:36:00 EST</pubdate>
88
+ </item>
89
+
90
+ <item>
91
+ <title>Burr Reorganization Bill Would Put Veterans' Health Care First</title>
92
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=69722f69-99d4-e00c-2cf6-dfaaab0b829c</link>
93
+ <category>Press Release</category>
94
+ <pubdate>Thu, 14 Mar 2013 11:01:00 EST</pubdate>
95
+ </item>
96
+
97
+ <item>
98
+ <title>Bill to Protect Americans From Bioterrorism and Pandemics Becomes Law</title>
99
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=65bd54eb-c17a-0c29-aed9-604dd6ceec8e</link>
100
+ <category>Press Release</category>
101
+ <pubdate>Wed, 13 Mar 2013 05:50:00 EST</pubdate>
102
+ </item>
103
+
104
+ <item>
105
+ <title>Burr Bill Will Modify Commencement Date on Camp Lejeune Water Contamination </title>
106
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=6586dabb-fb95-2952-3c2f-c57b0c77a622</link>
107
+ <category>Press Release</category>
108
+ <pubdate>Wed, 13 Mar 2013 04:51:00 EST</pubdate>
109
+ </item>
110
+
111
+ <item>
112
+ <title>Senators Burr, Hagan Reintroduce Bill that Would Allow Off-Road Vehicle Use on Cape Hatteras National Seashore</title>
113
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=46db2d27-0e21-ceac-d353-9121c89d17a6</link>
114
+ <category>Press Release</category>
115
+ <pubdate>Thu, 07 Mar 2013 04:54:00 EST</pubdate>
116
+ </item>
117
+
118
+ <item>
119
+ <title>Senator Burr Introduces Careers for Veterans Act</title>
120
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=46d955e3-c359-6136-c4df-10011c441cb1</link>
121
+ <category>Press Release</category>
122
+ <pubdate>Thu, 07 Mar 2013 04:52:00 EST</pubdate>
123
+ </item>
124
+
125
+ <item>
126
+ <title>Working to address our nation's economic issues</title>
127
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=46673ba9-c23c-c056-1ea2-1f01f61791e7</link>
128
+ <category>Blog</category>
129
+ <pubdate>Thu, 07 Mar 2013 02:49:00 EST</pubdate>
130
+ </item>
131
+
132
+ <item>
133
+ <title>Senator Burr Introduces "Vietnam Veterans Day" Resolution</title>
134
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=223a1adb-daf8-ba63-d999-a5aef5e96ec9</link>
135
+ <category>Press Release</category>
136
+ <pubdate>Thu, 28 Feb 2013 02:10:00 EST</pubdate>
137
+ </item>
138
+
139
+ <item>
140
+ <title>Senator Burr Applauds Unanimous Passage of the Pandemic and All-Hazards Preparedness Reauthorization Act of 2013 (PAHPRA) </title>
141
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=2217055e-c37f-4540-e654-e0d1997ed67b</link>
142
+ <category>Press Release</category>
143
+ <pubdate>Thu, 28 Feb 2013 01:31:00 EST</pubdate>
144
+ </item>
145
+
146
+ <item>
147
+ <title>1400 Days Since the Senate Last Passed A Budget</title>
148
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=183105fd-9cb5-0e29-7ef9-8bc6bcb17e1f</link>
149
+ <category>Blog</category>
150
+ <pubdate>Tue, 26 Feb 2013 02:35:00 EST</pubdate>
151
+ </item>
152
+
153
+ <item>
154
+ <title>MEDIA ADVISORY: Senator Burr Announces Events for February 19-21, 2013</title>
155
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=dfbb3931-c6e8-a0be-9415-319eba9d2190</link>
156
+ <category>Press Release</category>
157
+ <pubdate>Fri, 15 Feb 2013 04:20:00 EST</pubdate>
158
+ </item>
159
+
160
+ <item>
161
+ <title>Senator Burr Introduces Bipartisan Bill to Renew and Improve Landmark Conservation Program</title>
162
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=dad2788d-ee57-0a95-15a2-1e232317ca94</link>
163
+ <category>Press Release</category>
164
+ <pubdate>Thu, 14 Feb 2013 05:24:00 EST</pubdate>
165
+ </item>
166
+
167
+ <item>
168
+ <title>Senator Burr: IOM report underscores need for track and trace system </title>
169
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=d57f4e69-97b5-2d4a-138d-ac5454c8b20e</link>
170
+ <category>Blog</category>
171
+ <pubdate>Wed, 13 Feb 2013 04:37:00 EST</pubdate>
172
+ </item>
173
+
174
+ <item>
175
+ <title>Senator Burr Questions Jack Lew at Finance Committee Hearing</title>
176
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=d56fcaf1-f725-3d26-469d-657ca4fa92f8</link>
177
+ <category>Blog</category>
178
+ <pubdate>Wed, 13 Feb 2013 04:21:00 EST</pubdate>
179
+ </item>
180
+
181
+ <item>
182
+ <title>Senator Burr Applauds the Passage of the Pandemic and All-Hazards Preparedness Act of 2013 (PAHPA) by the HELP Committee</title>
183
+ <link>index.cfm?FuseAction=PressOffice.Blogs&amp;Type=Blog&amp;ContentRecord_id=d54beed7-fdcf-7d37-f380-2e80e2b0a598</link>
184
+ <category>Blog</category>
185
+ <pubdate>Wed, 13 Feb 2013 03:38:00 EST</pubdate>
186
+ </item>
187
+
188
+ <item>
189
+ <title>Senator Burr Statement on the State of the Union Address</title>
190
+ <link>index.cfm?FuseAction=PressOffice.PressReleases&amp;Type=Press Release&amp;ContentRecord_id=d3ffaeda-a2af-186e-a4e8-bac2286b0d03</link>
191
+ <category>Press Release</category>
192
+ <pubdate>Wed, 13 Feb 2013 09:38:00 EST</pubdate>
193
+ </item>
194
+
195
+ </channel>
196
+ </rss>
@@ -24,6 +24,15 @@ describe Statement do
24
24
  @results = Statement::Link.from_rss(@feed_url)
25
25
  @results.first[:date].must_equal nil
26
26
  end
27
+
28
+ it "parses invalid RSS" do
29
+ @feed_url = "http://www.burr.senate.gov/public/index.cfm?FuseAction=RSS.Feed"
30
+ stub_request(:any, @feed_url).to_return(:body => File.new(File.join(File.dirname(__FILE__), "richard_burr.xml")), :status => 200)
31
+
32
+ @results = Statement::Link.from_rss(@feed_url)
33
+ @results.first[:url].must_equal "http://www.burr.senate.gov/public/index.cfm?FuseAction=PressOffice.PressReleases&Type=Press Release&ContentRecord_id=65dbea38-d64c-6208-ef8f-2b000e899b3a"
34
+ @results.first[:date].to_s.must_equal "2013-05-02"
35
+ end
27
36
 
28
37
  it "handles relative URLs" do
29
38
  @feed_url = "http://www.gop.gov/republicans/news?offset=03/29/13"
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.6'
4
+ version: '0.7'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-02 00:00:00.000000000 Z
12
+ date: 2013-05-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &2152470040 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2152470040
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rake
27
- requirement: &2152469580 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *2152469580
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: webmock
38
- requirement: &2152469100 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,10 +53,15 @@ dependencies:
43
53
  version: '0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2152469100
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: american_date
49
- requirement: &2152468680 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ! '>='
@@ -54,10 +69,15 @@ dependencies:
54
69
  version: '0'
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *2152468680
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: nokogiri
60
- requirement: &2152468220 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ! '>='
@@ -65,7 +85,12 @@ dependencies:
65
85
  version: '0'
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *2152468220
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
69
94
  description: Crawls congressional websites for press releases.
70
95
  email:
71
96
  - dwillis@gmail.com
@@ -84,6 +109,7 @@ files:
84
109
  - spec/cowan_press.html
85
110
  - spec/culberson_rss.xml
86
111
  - spec/house_gop_releases.html
112
+ - spec/richard_burr.xml
87
113
  - spec/ruiz_rss.xml
88
114
  - spec/statement_spec.rb
89
115
  - spec/vitter_press.html
@@ -101,15 +127,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
127
  - - ! '>='
102
128
  - !ruby/object:Gem::Version
103
129
  version: '0'
130
+ segments:
131
+ - 0
132
+ hash: 3428073218065646458
104
133
  required_rubygems_version: !ruby/object:Gem::Requirement
105
134
  none: false
106
135
  requirements:
107
136
  - - ! '>='
108
137
  - !ruby/object:Gem::Version
109
138
  version: '0'
139
+ segments:
140
+ - 0
141
+ hash: 3428073218065646458
110
142
  requirements: []
111
143
  rubyforge_project:
112
- rubygems_version: 1.8.17
144
+ rubygems_version: 1.8.24
113
145
  signing_key:
114
146
  specification_version: 3
115
147
  summary: Given a url, Statement returns links to press releases and official statements.
@@ -118,6 +150,7 @@ test_files:
118
150
  - spec/cowan_press.html
119
151
  - spec/culberson_rss.xml
120
152
  - spec/house_gop_releases.html
153
+ - spec/richard_burr.xml
121
154
  - spec/ruiz_rss.xml
122
155
  - spec/statement_spec.rb
123
156
  - spec/vitter_press.html