campaign_cash 2.3.1 → 2.3.2
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.
- data/README.rdoc +8 -1
- data/lib/campaign_cash/committee.rb +1 -1
- data/lib/campaign_cash/electioneering_communication.rb +3 -3
- data/lib/campaign_cash/filing_summary.rb +1 -1
- data/lib/campaign_cash/independent_expenditure.rb +1 -1
- data/lib/campaign_cash/individual_contribution.rb +3 -3
- data/lib/campaign_cash/version.rb +1 -1
- data/test/campaign_cash/test_candidate.rb +7 -7
- metadata +49 -85
data/README.rdoc
CHANGED
@@ -8,10 +8,12 @@
|
|
8
8
|
|
9
9
|
== DESCRIPTION:
|
10
10
|
|
11
|
-
Simple ruby wrapper for The New York Times Campaign Finance API[http://developer.nytimes.com/docs/read/campaign_finance_api]. You'll need an API key.
|
11
|
+
Simple ruby wrapper for The New York Times Campaign Finance API[http://developer.nytimes.com/docs/read/campaign_finance_api]. You'll need an API key. Tested under Ruby 1.8.7, 1.9.2 and 1.9.3 and JRuby 1.6.7.
|
12
12
|
|
13
13
|
== News
|
14
14
|
|
15
|
+
* April 10, 2012: Version 2.3.2 released. Bugfix for Committee#find.
|
16
|
+
* March 22, 2012: Version 2.3.1 released. Added filing_id to Filing objects and Committee#unamended_filings method.
|
15
17
|
* March 15, 2012: Version 2.3 released. Added committee_type to Filing objects and offset to Candidate methods.
|
16
18
|
* March 9, 2012: Version 2.2.1 released. Added transfers_in attribute to President#detail.
|
17
19
|
* Feb. 8, 2012: Version 2.1.0 released. Added better support for independent expenditures and FilingSummary class for presidential candidate filings.
|
@@ -113,6 +115,11 @@ Individual Committee objects can retrieve an array of filings they have made dur
|
|
113
115
|
committee.filings
|
114
116
|
#=> [#<CampaignCash::Filing:0x101bc9100 @amended_uri=nil, @paper=false, @amended=false, @committee_name=nil, @date_coverage_from=#<Date: 4911793/2,0,2299161>, @original_uri=nil, @report_title="YEAR-END", @date_coverage_to=#<Date: 4911853/2,0,2299161>, @form_type="F3", @committee=nil, @original_filing=nil, @fec_uri="http://query.nictusa.com/cgi-bin/dcdev/forms/C00326389/756540/">,...]
|
115
117
|
|
118
|
+
The filings method returns an array of all filings, including originals and amendments. If you want to retrieve the list of unamended filings for a committee within a cycle -- in other words, the latest version of reports -- use the unamended_filings method:
|
119
|
+
|
120
|
+
committee = Committee.find("C00326389", 2012)
|
121
|
+
committee.unamended_filings
|
122
|
+
|
116
123
|
For more information on Filing objects, see Filings below.
|
117
124
|
|
118
125
|
To retrieve a list of the 20 most recently added committees (note that no cycle parameter is needed; this method always uses the most recent cycle):
|
@@ -85,7 +85,7 @@ module CampaignCash
|
|
85
85
|
:interest_group => get_interest_group(params['interest_group']),
|
86
86
|
:committee_type => get_committee_type(params['committee_type']),
|
87
87
|
:designation => get_designation(params['designation']),
|
88
|
-
:other_cycles => params['other_cycles'].map{|cycle| cycle['cycle']['
|
88
|
+
:other_cycles => params['other_cycles'].map{|cycle| cycle['cycle']['cycle']}
|
89
89
|
end
|
90
90
|
|
91
91
|
def self.create_from_search_results(params={})
|
@@ -15,20 +15,20 @@ module CampaignCash
|
|
15
15
|
def self.latest(offset = nil)
|
16
16
|
cycle = CURRENT_CYCLE
|
17
17
|
results = invoke("#{cycle}/electioneering_communications", {:offset => offset})['results']
|
18
|
-
results.map {|obj| ElectioneeringCommunication.create(obj
|
18
|
+
results.map {|obj| ElectioneeringCommunication.create(obj)}
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.committee(committee_id, offset = nil)
|
22
22
|
cycle = CURRENT_CYCLE
|
23
23
|
results = invoke("#{cycle}/committees/#{committee_id}/electioneering_communications", {:offset => offset})['results']
|
24
|
-
results.map {|obj| ElectioneeringCommunication.create(obj
|
24
|
+
results.map {|obj| ElectioneeringCommunication.create(obj)}
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.date(date, offset = nil)
|
28
28
|
cycle = CURRENT_CYCLE
|
29
29
|
d = Date.strptime(date, '%m/%d/%Y')
|
30
30
|
results = invoke("#{cycle}/electioneering_communications/#{d.year}/#{d.month}/#{d.day}", {:offset => offset})['results']
|
31
|
-
results.map {|obj| ElectioneeringCommunication.create(obj
|
31
|
+
results.map {|obj| ElectioneeringCommunication.create(obj)}
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -15,7 +15,7 @@ module CampaignCash
|
|
15
15
|
|
16
16
|
def self.by_id(id)
|
17
17
|
cycle = CURRENT_CYCLE
|
18
|
-
result = FilingSummary.create(Base.invoke("#{cycle}/filings/#{id}")["results"]
|
18
|
+
result = FilingSummary.create(Base.invoke("#{cycle}/filings/#{id}")["results"])
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class IndependentExpenditure < Base
|
3
3
|
|
4
|
-
attr_reader :committee, :district, :state, :committee_name, :purpose, :candidate, :candidate_name, :support_or_oppose, :date, :amount, :office, :amendment, :date_received, :payee, :fec_uri, :transaction_id, :unique_id
|
4
|
+
attr_reader :committee, :district, :state, :committee_name, :purpose, :candidate, :candidate_name, :support_or_oppose, :date, :amount, :office, :amendment, :date_received, :payee, :fec_uri, :transaction_id, :unique_id, :filing_id, :amended_from
|
5
5
|
|
6
6
|
def initialize(params={})
|
7
7
|
params.each_pair do |k,v|
|
@@ -16,19 +16,19 @@ module CampaignCash
|
|
16
16
|
def self.committee(fecid, offset=nil)
|
17
17
|
cycle = CURRENT_CYCLE
|
18
18
|
results = invoke("#{cycle}/contributions/committee/#{fecid}", {:offset => offset})['results']
|
19
|
-
results.map{|c| IndividualContribution.create(c
|
19
|
+
results.map{|c| IndividualContribution.create(c) }
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.filing(form_id, offset=nil)
|
23
23
|
cycle = CURRENT_CYCLE
|
24
24
|
results = invoke("#{cycle}/contributions/filing/#{form_id}", {:offset => offset})['results']
|
25
|
-
results.map{|c| IndividualContribution.create(c
|
25
|
+
results.map{|c| IndividualContribution.create(c) }
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.candidate(fecid, offset=nil)
|
29
29
|
cycle = CURRENT_CYCLE
|
30
30
|
results = invoke("#{cycle}/contributions/candidate/#{fecid}", {:offset => offset})['results']
|
31
|
-
results.map{|c| IndividualContribution.create(c
|
31
|
+
results.map{|c| IndividualContribution.create(c) }
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
@@ -74,20 +74,20 @@ class TestCampaignCash::TestCandidate < Test::Unit::TestCase
|
|
74
74
|
end
|
75
75
|
|
76
76
|
context "state candidates" do
|
77
|
-
should "return
|
78
|
-
assert_equal Candidate.state('RI', nil, nil, 2010).
|
77
|
+
should "return 33 total candidates from Rhode Island" do
|
78
|
+
assert_equal Candidate.state('RI', nil, nil, 2010).size, 33
|
79
79
|
end
|
80
80
|
|
81
|
-
should "return
|
82
|
-
assert_equal Candidate.state('RI', "house", nil, 2010).
|
81
|
+
should "return 30 House candidates from Rhode Island" do
|
82
|
+
assert_equal Candidate.state('RI', "house", nil, 2010).size, 30
|
83
83
|
end
|
84
84
|
|
85
|
-
should "return 3 Senate candidates from Rhode Island" do
|
86
|
-
assert_equal Candidate.state('RI', "senate", nil, 2010).
|
85
|
+
should "return least 3 Senate candidates from Rhode Island" do
|
86
|
+
assert_equal Candidate.state('RI', "senate", nil, 2010).size, 3
|
87
87
|
end
|
88
88
|
|
89
89
|
should "return 17 House candidates from District 1 of Rhode Island" do
|
90
|
-
assert_equal Candidate.state('RI', "house", 1, 2010).
|
90
|
+
assert_equal Candidate.state('RI', "house", 1, 2010).size, 17
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
metadata
CHANGED
@@ -1,92 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: campaign_cash
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.3.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 3
|
9
|
-
- 1
|
10
|
-
version: 2.3.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Derek Willis
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-10 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: json
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153723340 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: rake
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *2153723340
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &2153722800 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
hash: 49
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
- 8
|
46
|
-
- 7
|
29
|
+
requirements:
|
30
|
+
- - =
|
31
|
+
- !ruby/object:Gem::Version
|
47
32
|
version: 0.8.7
|
48
33
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: bundler
|
52
34
|
prerelease: false
|
53
|
-
|
35
|
+
version_requirements: *2153722800
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
38
|
+
requirement: &2153722300 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 23
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 0
|
62
|
-
- 0
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
63
43
|
version: 1.0.0
|
64
44
|
type: :development
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: shoulda
|
68
45
|
prerelease: false
|
69
|
-
|
46
|
+
version_requirements: *2153722300
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: shoulda
|
49
|
+
requirement: &2153721920 !ruby/object:Gem::Requirement
|
70
50
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
78
55
|
type: :development
|
79
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2153721920
|
80
58
|
description: A client for The New York Times Campaign Finance API
|
81
|
-
email:
|
59
|
+
email:
|
82
60
|
- dwillis@nytimes.com
|
83
61
|
executables: []
|
84
|
-
|
85
62
|
extensions: []
|
86
|
-
|
87
63
|
extra_rdoc_files: []
|
88
|
-
|
89
|
-
files:
|
64
|
+
files:
|
90
65
|
- .gitignore
|
91
66
|
- Gemfile
|
92
67
|
- Gemfile.lock
|
@@ -119,40 +94,29 @@ files:
|
|
119
94
|
- test/test_helper.rb
|
120
95
|
homepage: http://rubygems.org/gems/campaign_cash
|
121
96
|
licenses: []
|
122
|
-
|
123
97
|
post_install_message:
|
124
98
|
rdoc_options: []
|
125
|
-
|
126
|
-
require_paths:
|
99
|
+
require_paths:
|
127
100
|
- lib
|
128
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
102
|
none: false
|
130
|
-
requirements:
|
131
|
-
- -
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
134
|
-
|
135
|
-
- 0
|
136
|
-
version: "0"
|
137
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
108
|
none: false
|
139
|
-
requirements:
|
140
|
-
- -
|
141
|
-
- !ruby/object:Gem::Version
|
142
|
-
hash: 23
|
143
|
-
segments:
|
144
|
-
- 1
|
145
|
-
- 3
|
146
|
-
- 6
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
147
112
|
version: 1.3.6
|
148
113
|
requirements: []
|
149
|
-
|
150
114
|
rubyforge_project: campaign_cash
|
151
115
|
rubygems_version: 1.8.17
|
152
116
|
signing_key:
|
153
117
|
specification_version: 3
|
154
118
|
summary: Following the money.
|
155
|
-
test_files:
|
119
|
+
test_files:
|
156
120
|
- test/campaign_cash/test_candidate.rb
|
157
121
|
- test/campaign_cash/test_committee.rb
|
158
122
|
- test/campaign_cash/test_electioneering_communication.rb
|