campaign_cash 2.8 → 2.8.1

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: 2ffa1ad1122a56b045154a43dd37a26679a1201f
4
- data.tar.gz: 88c5780a627ea2e81dfc36a4f030093ea5fdde38
3
+ metadata.gz: 736e2718d879b9f919b26fc76e0bb3ba18684e05
4
+ data.tar.gz: 94c506febe49607d86dc1ded0c8cc44f0c132462
5
5
  SHA512:
6
- metadata.gz: 5384e7b157d7cf8de8e24cff064c00169ca7584e7a6e99e261f034f540fced80a92f8db6ef6f4e7da60d71d0f8888e0fc63736c7bcfabaf49e4414a7cd812d44
7
- data.tar.gz: 312b34e7564a52e262061a54e8ee87116a76f3d804afbebdfd667bf41c7471aaa3f0ff95869d0414d9a70e2cfacae3beb46f4adc6ea1b86abc615a3ffd544f64
6
+ metadata.gz: 30f1108210518da5ff61c6f58540e472bfb34436d71d7b2a8b6ac26046a23bc0acfd9171f12ff4614e4a1408e9bc58d726112d7ef98b6d3a65d46278708c8c05
7
+ data.tar.gz: d6ab5ea48c38714330d36cfbdd7aa7f645ed3c750754cde8ea93f5e29a507aa69ef0f72e7f1299d1d10ac27d04e341665364323ff9486c22d43ee858e9a17f20
@@ -10,7 +10,7 @@ module CampaignCash
10
10
  API_VERSION = 'v3'
11
11
  API_NAME = 'elections/us'
12
12
  API_BASE = "/svc/#{API_NAME}/#{API_VERSION}/finances"
13
- CURRENT_CYCLE = 2014
13
+ CURRENT_CYCLE = 2016
14
14
 
15
15
  @@api_key = nil
16
16
  @@copyright = nil
@@ -1,3 +1,3 @@
1
1
  module CampaignCash
2
- VERSION = "2.8"
2
+ VERSION = "2.8.1"
3
3
  end
@@ -2,70 +2,70 @@ require 'test_helper'
2
2
 
3
3
  class TestCampaignCash::TestCommittee < Minitest::Test
4
4
  include CampaignCash
5
-
5
+
6
6
  context "Committee.create_from_api" do
7
7
  setup do
8
8
  reply = Base.invoke('2010/committees/C00312223', {})
9
9
  @result = reply['results'].first
10
10
  @committee = Committee.create(@result)
11
11
  end
12
-
12
+
13
13
  should "return an object of the Committee type" do
14
14
  assert_kind_of(Committee, @committee)
15
15
  end
16
-
16
+
17
17
  %w(name id state party fec_uri candidate).each do |attr|
18
18
  should "assign the value of the @#{attr} attribute from the '#{attr}' key in the hash" do
19
19
  assert_equal(@result[attr], @committee.send(attr))
20
20
  end
21
21
  end
22
22
  end
23
-
23
+
24
24
  context "Committee search" do
25
25
  setup do
26
26
  @committees = Committee.search("Obama for America", 2012)
27
27
  end
28
-
28
+
29
29
  should "return two committee objects" do
30
30
  assert_equal @committees.size, 1
31
31
  assert_kind_of(Committee, @committees.first)
32
32
  assert_kind_of(Committee, @committees.last)
33
33
  end
34
34
  end
35
-
35
+
36
36
  context "New Committees" do
37
37
  setup do
38
38
  reply = Base.invoke('2010/committees/new', {})
39
39
  results = reply['results']
40
40
  @committees = results.map{|c| Committee.create_from_search_results(c)}
41
41
  end
42
-
42
+
43
43
  should "return 20 new committees" do
44
44
  assert_equal @committees.size, 20
45
45
  assert_kind_of(Committee, @committees.first)
46
46
  assert_kind_of(Committee, @committees.last)
47
47
  end
48
48
  end
49
-
49
+
50
50
  context "committee filings" do
51
51
  setup do
52
52
  reply = Base.invoke('2010/committees/C00312223/filings', {})
53
53
  results = reply['results']
54
54
  @filings = results.map{|f| Filing.create(f)}
55
55
  end
56
-
56
+
57
57
  should "return 11 filings" do
58
58
  assert_equal @filings.size, 11
59
59
  end
60
60
  end
61
-
61
+
62
62
  context "committee unamended filings" do
63
63
  setup do
64
64
  reply = Base.invoke('2012/committees/C00431171/filings', {})
65
65
  results = reply['results'].select{|f| f['amended'] == false}
66
66
  @filings = results.map{|f| Filing.create(f)}
67
67
  end
68
-
68
+
69
69
  should "return filings that are not amended" do
70
70
  assert_equal @filings.select{|f| f.amended == true}.size, 0
71
71
  end
@@ -75,48 +75,48 @@ class TestCampaignCash::TestCommittee < Minitest::Test
75
75
  setup do
76
76
  @committee = Committee.find('C00084475', 2012)
77
77
  end
78
-
79
- should "return 17 other cycles" do
80
- assert_equal @committee.other_cycles.size, 17
78
+
79
+ should "return 18 other cycles" do
80
+ assert_equal @committee.other_cycles.size, 18
81
81
  end
82
82
  end
83
-
83
+
84
84
  context "committee contributions" do
85
85
  setup do
86
86
  @contribution = Contribution.find('C00458588', 2010)
87
87
  end
88
-
88
+
89
89
  should "return 141 total results" do
90
90
  assert_equal @contribution.total_results, 141
91
91
  end
92
-
92
+
93
93
  should "return a $5,000 contribution to Renee Ellmers" do
94
94
  assert_equal @contribution.results.detect{|c| c.candidate == "H0NC02059"}.amount, 5000
95
95
  end
96
-
96
+
97
97
  end
98
-
98
+
99
99
  context "committee contributions to a candidate" do
100
100
  setup do
101
101
  reply = Base.invoke('2010/committees/C00458588/contributions/candidates/H0NC02059', {})
102
102
  @contribution = Contribution.to_candidate(reply)
103
103
  end
104
-
104
+
105
105
  should "return 2 results totaling $10,000" do
106
106
  assert_equal @contribution.results.size, 2
107
107
  assert_equal @contribution.total_amount, 10000
108
108
  end
109
109
  end
110
-
110
+
111
111
  context "superpacs" do
112
112
  setup do
113
113
  reply = Base.invoke('2012/committees/superpacs')
114
114
  @committees = reply['results'].map{|c| Committee.create_from_search_results(c) }
115
115
  end
116
-
116
+
117
117
  should "return an array of super pacs" do
118
118
  assert_equal([true], @committees.map{|c| c.super_pac }.uniq)
119
119
  end
120
120
  end
121
-
122
- end
121
+
122
+ end
@@ -2,57 +2,57 @@ require 'test_helper'
2
2
 
3
3
  class TestCampaignCash::TestIndependentExpenditure < Minitest::Test
4
4
  include CampaignCash
5
-
5
+
6
6
  context "latest independent expenditures" do
7
7
  setup do
8
8
  @independent_expenditures = IndependentExpenditure.latest
9
9
  end
10
-
10
+
11
11
  should "return a list of objects of the IndependentExpenditure type" do
12
12
  assert_kind_of(IndependentExpenditure, @independent_expenditures.first)
13
13
  end
14
14
  end
15
-
15
+
16
16
  context "independent expenditures by date" do
17
17
  setup do
18
18
  @independent_expenditures = IndependentExpenditure.date("12/13/2011")
19
19
  end
20
-
21
- should "return at least one independent expenditure against Barack Obama" do
22
- assert_equal("P80003338", @independent_expenditures.select{|ie| ie.candidate == 'P80003338'}.first.candidate)
20
+
21
+ should "return at least one independent expenditure against Mitt Romney" do
22
+ assert_equal("P80003353", @independent_expenditures.select{|ie| ie.candidate == 'P80003353'}.first.candidate)
23
23
  end
24
24
  end
25
-
25
+
26
26
  context "a committee's independent expenditures in a cycle" do
27
27
  setup do
28
28
  @independent_expenditures = IndependentExpenditure.committee("C00490045", 2012)
29
29
  end
30
-
30
+
31
31
  should "return an array of IEs in the presidential race" do
32
32
  assert_equal("President", @independent_expenditures.first.office)
33
33
  end
34
34
  end
35
-
35
+
36
36
  context "independent expenditures about a given candidate" do
37
37
  setup do
38
38
  @independent_expenditures = IndependentExpenditure.candidate("P60003654", 2012)
39
39
  @candidate = Candidate.find('P60003654', 2012)
40
40
  end
41
-
41
+
42
42
  should "return an array of IEs about presidential candidate Newt Gingrich" do
43
43
  assert_equal("President", @independent_expenditures.first.office)
44
44
  assert_equal(@candidate.name, "GINGRICH, NEWT")
45
45
  end
46
46
  end
47
-
47
+
48
48
  context "independent expenditures in the presidential campaign" do
49
49
  setup do
50
50
  @independent_expenditures = IndependentExpenditure.president
51
51
  end
52
-
52
+
53
53
  should "return an array of IEs about the presidential campaign" do
54
54
  assert_equal(['President'], @independent_expenditures.map{|i| i.office }.uniq)
55
55
  end
56
56
  end
57
-
58
- end
57
+
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campaign_cash
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.8'
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Willis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -140,3 +140,4 @@ test_files:
140
140
  - test/campaign_cash/test_late_contribution.rb
141
141
  - test/campaign_cash/test_president.rb
142
142
  - test/test_helper.rb
143
+ has_rdoc: