catobills 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/catobills.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "catobills/version"
2
2
  require "catobills/bill"
3
+ require "catobills/federal_body"
3
4
  require 'httparty'
4
5
  require 'oj'
5
6
  require 'ox'
@@ -5,7 +5,7 @@ module Catobills
5
5
 
6
6
  FILTER_LIST = ['Commission', 'Board', 'Secretary', 'Department', 'Administrator', 'Administration', 'House', 'Senate', 'Director', 'Advisory Committee', 'Task Force',
7
7
  "Secretary's", "Under Secretary", "Administrator's", "Board's", "Service", "Department of State's", "CSCC's", "Bureau", "Inspector General of the Office", "Office",
8
- "Commissioner", "Assistant Secretary"]
8
+ "Commissioner", "Assistant Secretary", "Comptroller General"]
9
9
 
10
10
  def initialize(params={})
11
11
  params.each_pair do |k,v|
@@ -38,7 +38,7 @@ module Catobills
38
38
 
39
39
  def self.populate_acts(bill_body)
40
40
  results = bill_body.locate('legis-body/*/cato:entity-ref').select{|ref| ref['entity-type'] == 'act'}
41
- array_count(results.map{|ref| ref.text.gsub(/\s+/, " ").strip}.compact.reject{|ref| ref[0] != ref[0].upcase}).reject{|ref| ref[0] == '('}.reject{|ref| ['Section', 'section', 'chapter', 'subsection'].any? {|s| ref.include?(s)}}
41
+ array_count(results.map{|ref| ref[:value].gsub(/\s+/, " ").strip.split('/').first}.compact.reject{|ref| ref[0] != ref[0].upcase}).reject{|ref| ref[0] == '('}.reject{|ref| ['Section', 'section', 'chapter', 'subsection'].any? {|s| ref.include?(s)}}
42
42
  end
43
43
 
44
44
  # collects mentions of federal bodies, removing 'Congress', leadership offices, 'Commission', 'Board' and offices within agencies.
@@ -0,0 +1,20 @@
1
+ module Catobills
2
+ class FederalBody
3
+
4
+ attr_reader :id, :name, :abbrev
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 self.load
13
+ url = "http://dwillis.github.io/catobills/federal-bodies.json"
14
+ response = HTTParty.get(url)
15
+ bodies = Oj.load(response.body)
16
+ bodies.map{|b| self.new( id: b['id'], name: b['name'], abbrev: b['abbrev'])}
17
+ end
18
+
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Catobills
2
- VERSION = "0.5"
2
+ VERSION = "0.6"
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: catobills
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
5
- prerelease:
4
+ version: '0.6'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Derek Willis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2014-01-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,97 +27,85 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: minitest
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: webmock
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: oj
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: ox
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: httparty
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  description: Wrapper for Cato's Deep Bills API
@@ -136,35 +121,38 @@ files:
136
121
  - README.md
137
122
  - Rakefile
138
123
  - catobills.gemspec
124
+ - federal-bodies.json
125
+ - federal-bodies.xml
126
+ - lib/.DS_Store
139
127
  - lib/catobills.rb
140
128
  - lib/catobills/bill.rb
129
+ - lib/catobills/federal_body.rb
141
130
  - lib/catobills/version.rb
142
131
  - test/s1328_113_is.json
143
132
  - test/test_bill.rb
144
133
  homepage: ''
145
134
  licenses:
146
135
  - MIT
136
+ metadata: {}
147
137
  post_install_message:
148
138
  rdoc_options: []
149
139
  require_paths:
150
140
  - lib
151
141
  required_ruby_version: !ruby/object:Gem::Requirement
152
- none: false
153
142
  requirements:
154
- - - ! '>='
143
+ - - '>='
155
144
  - !ruby/object:Gem::Version
156
145
  version: '0'
157
146
  required_rubygems_version: !ruby/object:Gem::Requirement
158
- none: false
159
147
  requirements:
160
- - - ! '>='
148
+ - - '>='
161
149
  - !ruby/object:Gem::Version
162
150
  version: '0'
163
151
  requirements: []
164
152
  rubyforge_project:
165
- rubygems_version: 1.8.25
153
+ rubygems_version: 2.2.1
166
154
  signing_key:
167
- specification_version: 3
155
+ specification_version: 4
168
156
  summary: Extracts XML markup from Cato's Deep Bills Project
169
157
  test_files:
170
158
  - test/s1328_113_is.json