hulse 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb2a99da5c608cdd21b613eedec185ed0c2d68db
4
- data.tar.gz: cb4502cab20752d48fe70929db54071122509dc9
3
+ metadata.gz: 9bba650c8b0b6ada1ef76edc9a42070ab12e7890
4
+ data.tar.gz: 2047fb904a719d427a8f9e925c3fe70ce754b1b9
5
5
  SHA512:
6
- metadata.gz: 30d9cdfe34eb025d37f95b01e63b73711b562a96d5405ae74b92a8850a3839559f8e0998258804fb5902e197d7e1955595740227d4482332cc6d71ce4f06c489
7
- data.tar.gz: 38ba6c3b5b72b4a85ef54bdb448738e1f612427d3b990765bcdef0dd146f7cfc3289e7d66baf87e7246df4f5981b42e7b65e40074a95cc094ca13d52a349a273
6
+ metadata.gz: 623269c8d40b0489316c4053b664656e3aea73b484ffdf082898c0b58960d24e4fbb1c2205809b8e53ed28984cfcf3059273cc95359901235f5817047d8bef05
7
+ data.tar.gz: 1e0cd5aaa909e46753edb38c85e404711cceef893d11ddb56fc2ff144e1fa9f890f4d82a868458ddff023cd608a26673e0ee3a0c8693fd0c8930230b7fbac4da
data/README.md CHANGED
@@ -10,7 +10,7 @@ Hulse has two vote classes, `HouseVote` and `SenateVote`, which create Ruby obje
10
10
 
11
11
  Hulse also has two member classes, `HouseMember` and `SenateMember`, which create Ruby objects using the XML made available by the Clerk of the House and the Secretary of the Senate. House members have some basic information, including the unique `bioguide_id`, along with office details and committee and subcommittee assignment data. For vacant seats, information on the seat's previous occupant is available. Senate members have less information, but their data includes the Senate class and the URLs of their websites and email forms.
12
12
 
13
- Hulse has two other classes, `HouseFloor` and `Record`. The former provides a wrapper to [XML data on floor activity](http://clerk.house.gov/floorsummary/floor.aspx?day=20150729) published by the Clerk of the House, including timestamps and descriptions. The `Record` class provides a basic wrapper to the [Congressional Record](https://www.congress.gov/congressional-record), the daily listing of activities by the House and Senate, as well as some methods for accessing specific portions of it, particularly the titles and permalinks of articles.
13
+ Hulse has three other classes, `HouseFloor`, `Record` and `Communication.` The first provides a wrapper to [XML data on floor activity](http://clerk.house.gov/floorsummary/floor.aspx?day=20150729) published by the Clerk of the House, including timestamps and descriptions. The `Record` class provides a basic wrapper to the [Congressional Record](https://www.congress.gov/congressional-record), the daily listing of activities by the House and Senate, as well as some methods for accessing specific portions of it, particularly the titles and permalinks of articles. The `Communication` class provides a wrapper to [presidential and executive branch communications sent to the Senate](https://www.congress.gov/communications).
14
14
 
15
15
  Lastly, if you ever need to convert a year to its corresponding congress and session numbers, Hulse has a utility method for doing so.
16
16
 
@@ -64,7 +64,7 @@ irb(main):004:0> members.first
64
64
 
65
65
  ## Tests
66
66
 
67
- Hulse uses `MiniTest` for development. To run the tests, do `rake test`.
67
+ Hulse uses `MiniTest` for development. To run the tests: `rake test`.
68
68
 
69
69
  ## Authors
70
70
 
@@ -0,0 +1,47 @@
1
+ module Hulse
2
+ class Communication
3
+
4
+ attr_reader :id, :date, :committee, :url, :text
5
+
6
+ def initialize(params={})
7
+ params.each_pair do |k,v|
8
+ instance_variable_set("@#{k}", v)
9
+ end
10
+ end
11
+
12
+ def to_s
13
+ id
14
+ end
15
+
16
+ def self.presidential
17
+ comms = []
18
+ doc = HTTParty.get("https://www.congress.gov/communications?q=%7B%22communication-code%22%3A%22PM%22%7D&pageSize=250")
19
+ html = Nokogiri::HTML(doc.parsed_response)
20
+ (html/:ol/:li).each do |row|
21
+ comms << create(row)
22
+ end
23
+ comms
24
+ end
25
+
26
+ def self.executive
27
+ comms = []
28
+ doc = HTTParty.get("https://www.congress.gov/communications?q=%7B%22communication-code%22%3A%22EC%22%7D&pageSize=250")
29
+ html = Nokogiri::HTML(doc.parsed_response)
30
+ (html/:ol/:li).each do |row|
31
+ comms << create(row)
32
+ end
33
+ comms
34
+ end
35
+
36
+ def self.create(row)
37
+ self.new(id: row.children[3].children[0].text,
38
+ date: Date.strptime(row.children[3].children[1].text.split[1], "%m/%d/%Y"),
39
+ committee: row.children[3].children[1].text.split[3] + ' ' + row.children[3].children[1].text.split[4],
40
+ url: (row/:h2).first.children.find(:a).first['href'],
41
+ text: row.children[4].text.strip
42
+ )
43
+ end
44
+
45
+
46
+ end
47
+ end
data/lib/hulse/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hulse
2
- VERSION = "0.7"
2
+ VERSION = "0.8"
3
3
  end
data/lib/hulse.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'httparty'
2
2
  require 'oj'
3
3
  require 'nokogiri'
4
+ require 'htmlentities'
4
5
  require "hulse/version"
5
6
  require "hulse/record"
7
+ require "hulse/communication"
6
8
  require "hulse/house_vote"
7
9
  require "hulse/house_member"
8
10
  require "hulse/house_floor"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hulse
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Willis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-27 00:00:00.000000000 Z
11
+ date: 2015-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - Rakefile
124
124
  - hulse.gemspec
125
125
  - lib/hulse.rb
126
+ - lib/hulse/communication.rb
126
127
  - lib/hulse/house_floor.rb
127
128
  - lib/hulse/house_member.rb
128
129
  - lib/hulse/house_vote.rb