campaign_cash 2.0.7 → 2.0.8
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 +2 -0
- data/lib/campaign_cash/candidate.rb +1 -1
- data/lib/campaign_cash/version.rb +1 -1
- data/test/campaign_cash/test_candidate.rb +12 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -40,6 +40,8 @@ You'll want to set your API key as an environment variable in order to run the t
|
|
40
40
|
include CampaignCash
|
41
41
|
Base.api_key = YOUR_API_KEY
|
42
42
|
|
43
|
+
In a Rails app, you can put those lines in a file in config/initializers/.
|
44
|
+
|
43
45
|
Currently there are methods to support retrieving candidates, presidential candidates, committees, electronic filings, committee contributions and independent expenditures. Almost every method requires at least one parameter, the election cycle.
|
44
46
|
|
45
47
|
== Candidates
|
@@ -53,7 +53,7 @@ module CampaignCash
|
|
53
53
|
:office => parse_office(params['candidate']['id'][0..0]),
|
54
54
|
:district => parse_district(params['district']),
|
55
55
|
:party => params['candidate']['party'],
|
56
|
-
:
|
56
|
+
:committee_id => parse_committee(params['committee'])
|
57
57
|
|
58
58
|
end
|
59
59
|
|
@@ -19,13 +19,18 @@ class TestCampaignCash::TestCandidate < Test::Unit::TestCase
|
|
19
19
|
assert_equal(@result[attr], @candidate.send(attr))
|
20
20
|
end
|
21
21
|
end
|
22
|
+
|
23
|
+
should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
|
24
|
+
assert_equal(Base.parse_committee(@result['committee']), @candidate.committee_id)
|
25
|
+
end
|
26
|
+
|
22
27
|
end
|
23
28
|
|
24
29
|
context "Candidate search" do
|
25
30
|
setup do
|
26
31
|
reply = Base.invoke('2010/candidates/search', {:query => "Udall"})
|
27
|
-
results = reply['results']
|
28
|
-
@candidates = results.map{|c| Candidate.create_from_search_results(c)}
|
32
|
+
@results = reply['results']
|
33
|
+
@candidates = @results.map{|c| Candidate.create_from_search_results(c)}
|
29
34
|
end
|
30
35
|
|
31
36
|
should "return two candidate objects" do
|
@@ -33,6 +38,11 @@ class TestCampaignCash::TestCandidate < Test::Unit::TestCase
|
|
33
38
|
assert_kind_of(Candidate, @candidates.first)
|
34
39
|
assert_kind_of(Candidate, @candidates.last)
|
35
40
|
end
|
41
|
+
|
42
|
+
should "assign the committee_id to a stripped version of the attribute from the 'committee' key in the hash" do
|
43
|
+
assert_equal(Base.parse_committee(@results.first['committee']), @candidates.first.committee_id)
|
44
|
+
end
|
45
|
+
|
36
46
|
end
|
37
47
|
|
38
48
|
context "New Candidates" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campaign_cash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 8
|
10
|
+
version: 2.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Willis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-28 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|