campaign_cash 2.3.2 → 2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +12 -1
- data/lib/campaign_cash/base.rb +100 -100
- data/lib/campaign_cash/candidate.rb +103 -103
- data/lib/campaign_cash/committee.rb +102 -99
- data/lib/campaign_cash/contribution.rb +46 -36
- data/lib/campaign_cash/electioneering_communication.rb +4 -4
- data/lib/campaign_cash/filing.rb +59 -60
- data/lib/campaign_cash/filing_summary.rb +8 -8
- data/lib/campaign_cash/form.rb +7 -7
- data/lib/campaign_cash/independent_expenditure.rb +37 -35
- data/lib/campaign_cash/individual_contribution.rb +11 -11
- data/lib/campaign_cash/late_contribution.rb +37 -0
- data/lib/campaign_cash/president.rb +49 -49
- data/lib/campaign_cash/version.rb +1 -1
- data/lib/campaign_cash.rb +1 -1
- data/test/campaign_cash/test_candidate.rb +1 -1
- data/test/campaign_cash/test_committee.rb +2 -2
- data/test/campaign_cash/test_independent_expenditure.rb +1 -1
- data/test/campaign_cash/test_late_contribution.rb +24 -0
- data/test/test_helper.rb +1 -1
- metadata +87 -49
@@ -1,6 +1,6 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class Committee < Base
|
3
|
-
|
3
|
+
|
4
4
|
FILING_FREQUENCY = {
|
5
5
|
'A' => 'Administratively Terminated',
|
6
6
|
'D' => 'Debt',
|
@@ -9,7 +9,7 @@ module CampaignCash
|
|
9
9
|
'T' => 'Terminated',
|
10
10
|
'W' => 'Waived'
|
11
11
|
}
|
12
|
-
|
12
|
+
|
13
13
|
INTEREST_GROUP = {
|
14
14
|
'C' => 'Corporation',
|
15
15
|
'L' => 'Labor Union',
|
@@ -18,7 +18,7 @@ module CampaignCash
|
|
18
18
|
'V' => 'Cooperative',
|
19
19
|
'W' => 'Corporation without Capital Stock'
|
20
20
|
}
|
21
|
-
|
21
|
+
|
22
22
|
COMMITTEE_TYPE = {
|
23
23
|
'C' => 'Communication Cost',
|
24
24
|
'D' => 'Delegate',
|
@@ -33,7 +33,7 @@ module CampaignCash
|
|
33
33
|
'Y' => 'Qualified Party',
|
34
34
|
'Z' => 'National Party Non-Federal'
|
35
35
|
}
|
36
|
-
|
36
|
+
|
37
37
|
COMMITTEE_DESIGNATION = {
|
38
38
|
'A' => 'Authorized by a Candidate',
|
39
39
|
'J' => 'Joint Fundraiser',
|
@@ -42,126 +42,129 @@ module CampaignCash
|
|
42
42
|
'B' => 'Lobbyist/Registrant PAC',
|
43
43
|
'D' => 'Leadership PAC'
|
44
44
|
}
|
45
|
-
|
45
|
+
|
46
46
|
attr_reader :name, :id, :state, :district, :party, :fec_uri, :candidate,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
:city, :address, :state, :zip, :relative_uri, :sponsor_name,
|
48
|
+
:total_receipts, :total_contributions, :total_from_individuals,
|
49
|
+
:total_from_pacs, :candidate_loans, :total_disbursements,
|
50
|
+
:total_refunds, :debts_owed, :begin_cash, :end_cash,
|
51
|
+
:date_coverage_to, :date_coverage_from, :other_cycles, :super_pac, :filings,
|
52
|
+
:total_candidate_contributions, :total_independent_expenditures
|
53
|
+
|
53
54
|
def initialize(params={})
|
54
55
|
params.each_pair do |k,v|
|
55
56
|
instance_variable_set("@#{k}", v)
|
56
57
|
end
|
57
58
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
59
|
+
|
60
|
+
def self.create(params={})
|
61
|
+
self.new :name => params['name'],
|
62
|
+
:id => params['id'],
|
63
|
+
:state => params['state'],
|
64
|
+
:party => params['party'],
|
65
|
+
:fec_uri => params['fec_uri'],
|
66
|
+
:city => params['city'],
|
67
|
+
:address => params['address'],
|
68
|
+
:zip => params['zip'],
|
69
|
+
:sponsor_name => params['sponsor_name'],
|
70
|
+
:leadership => params['leadership'],
|
71
|
+
:super_pac => params['super_pac'],
|
72
|
+
:total_receipts => params['total_receipts'].to_f,
|
73
|
+
:total_contributions => params['total_contributions'].to_f,
|
74
|
+
:total_from_individuals => params['total_from_individuals'].to_f,
|
75
|
+
:total_from_pacs => params['total_from_pacs'].to_f,
|
76
|
+
:candidate_loans => params['candidate_loans'].to_f,
|
77
|
+
:total_disbursements => params['total_disbursements'].to_f,
|
78
|
+
:total_candidate_contributions => params['total_candidate_contributions'].to_f,
|
79
|
+
:total_independent_expenditures => params['total_independent_expenditures'].to_f,
|
80
|
+
:total_refunds => params['total_refunds'].to_f,
|
81
|
+
:debts_owed => params['debts_owed'].to_f,
|
82
|
+
:begin_cash => params['begin_cash'].to_f,
|
83
|
+
:end_cash => params['end_cash'].to_f,
|
84
|
+
:date_coverage_from => date_parser(params['date_coverage_from']),
|
85
|
+
:date_coverage_to => date_parser(params['date_coverage_to']),
|
86
|
+
:candidate_id => parse_candidate(params['candidate']),
|
87
|
+
:filing_frequency => get_frequency(params['filing_frequency']),
|
88
|
+
:interest_group => get_interest_group(params['interest_group']),
|
89
|
+
:committee_type => get_committee_type(params['committee_type']),
|
90
|
+
:designation => get_designation(params['designation']),
|
91
|
+
:other_cycles => params['other_cycles'].map{|cycle| cycle['cycle']['cycle']}
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.create_from_search_results(params={})
|
95
|
+
self.new :name => params['name'],
|
96
|
+
:id => params['id'],
|
97
|
+
:city => params['city'],
|
98
|
+
:state => params['state'],
|
99
|
+
:zip => params['zip'],
|
100
|
+
:district => params['district'],
|
101
|
+
:party => params['party'],
|
102
|
+
:candidate_id => parse_candidate(params['candidate']),
|
103
|
+
:treasurer => params['treasurer'],
|
104
|
+
:fec_uri => params['fec_uri'],
|
105
|
+
:leadership => params['leadership'],
|
106
|
+
:super_pac => params['super_pac']
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.get_frequency(frequency)
|
110
|
+
if frequency
|
111
|
+
FILING_FREQUENCY[frequency.strip] unless frequency.empty?
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.get_interest_group(interest_group)
|
116
|
+
if interest_group
|
117
|
+
INTEREST_GROUP[interest_group.strip] unless interest_group.empty?
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.get_committee_type(committee_type)
|
122
|
+
if committee_type
|
123
|
+
COMMITTEE_TYPE[committee_type.strip] unless committee_type.empty?
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.get_designation(designation)
|
128
|
+
if designation
|
129
|
+
COMMITTEE_DESIGNATION[designation.strip] unless designation.empty?
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
130
133
|
def self.find(fecid, cycle=CURRENT_CYCLE)
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
+
reply = invoke("#{cycle}/committees/#{fecid}")
|
135
|
+
result = reply['results']
|
136
|
+
create(result.first) if result.first
|
134
137
|
end
|
135
|
-
|
138
|
+
|
136
139
|
def self.search(name, cycle=CURRENT_CYCLE, offset=nil)
|
137
|
-
|
138
|
-
|
140
|
+
reply = invoke("#{cycle}/committees/search", {:query => name,:offset => offset})
|
141
|
+
results = reply['results']
|
139
142
|
results.map{|c| create_from_search_results(c)}
|
140
143
|
end
|
141
|
-
|
144
|
+
|
142
145
|
def self.latest(cycle=CURRENT_CYCLE)
|
143
|
-
|
144
|
-
|
146
|
+
reply = invoke("#{cycle}/committees/new",{})
|
147
|
+
results = reply['results']
|
145
148
|
results.map{|c| create_from_search_results(c)}
|
146
149
|
end
|
147
|
-
|
150
|
+
|
148
151
|
def self.superpacs(cycle=CURRENT_CYCLE, offset=nil)
|
149
152
|
reply = invoke("#{cycle}/committees/superpacs",{:offset => offset})
|
150
|
-
|
153
|
+
results = reply['results']
|
151
154
|
results.map{|c| create_from_search_results(c)}
|
152
155
|
end
|
153
|
-
|
156
|
+
|
154
157
|
def filings(cycle=CURRENT_CYCLE, offset=nil)
|
155
158
|
reply = Base.invoke("#{cycle}/committees/#{id}/filings",{:offset => offset})
|
156
|
-
|
159
|
+
results = reply['results']
|
157
160
|
results.map{|c| Filing.create(c)}
|
158
161
|
end
|
159
|
-
|
162
|
+
|
160
163
|
def unamended_filings(cycle=CURRENT_CYCLE, offset=nil)
|
161
164
|
reply = Base.invoke("#{cycle}/committees/#{id}/filings",{:offset => offset})
|
162
|
-
|
165
|
+
results = reply['results'].select{|f| f['amended'] == false}
|
163
166
|
results.map{|c| Filing.create(c)}
|
164
167
|
end
|
165
|
-
|
168
|
+
|
166
169
|
end
|
167
170
|
end
|
@@ -1,57 +1,67 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class Contribution < Base
|
3
|
-
|
4
|
-
attr_reader :date, :candidate_uri, :primary_general, :amount, :state, :name,
|
5
|
-
|
3
|
+
|
4
|
+
attr_reader :date, :candidate_uri, :primary_general, :amount, :state, :name,
|
5
|
+
:image_uri, :party, :district, :committee_uri, :results, :total_results, :total_amount,
|
6
|
+
:cycle, :record_number, :transaction_id, :transaction_type
|
7
|
+
|
6
8
|
def initialize(params={})
|
7
9
|
params.each_pair do |k,v|
|
8
10
|
instance_variable_set("@#{k}", v)
|
9
11
|
end
|
10
12
|
end
|
11
|
-
|
13
|
+
|
12
14
|
def self.to_candidate(params={})
|
13
15
|
self.new :committee => parse_committee(params['committee']),
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
16
|
+
:cycle => params['cycle'].to_i,
|
17
|
+
:total_amount => params['total_amount'].to_f,
|
18
|
+
:results => params['results'].map{|c| OpenStruct.new({
|
19
|
+
:candidate => parse_candidate(params['candidate_uri']),
|
20
|
+
:date => date_parser(c['date']),
|
21
|
+
:primary_general => c['primary_general'],
|
22
|
+
:amount => c['amount'].to_f,
|
23
|
+
:state => c['state'],
|
24
|
+
:name => c['name'],
|
25
|
+
:image_uri => c['image_uri'],
|
26
|
+
:party => c['party'],
|
27
|
+
:district => c['district'],
|
28
|
+
:record_number => c['record_number'],
|
29
|
+
:transaction_type => c['transaction_type'],
|
30
|
+
:transaction_id => c['transaction_id']
|
31
|
+
})}
|
32
|
+
|
27
33
|
end
|
28
|
-
|
34
|
+
|
29
35
|
def self.all_candidates(params={})
|
30
36
|
self.new :committee => parse_committee(params['committee']),
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
:cycle => params['cycle'].to_i,
|
38
|
+
:total_amount => params['total_amount'].to_f,
|
39
|
+
:total_results => params['total_results'].to_i,
|
40
|
+
:results => params['results'].map{|c| OpenStruct.new({
|
41
|
+
:date => date_parser(c['date']),
|
42
|
+
:candidate => parse_candidate(c['candidate_uri']),
|
43
|
+
:primary_general => c['primary_general'],
|
44
|
+
:amount => c['amount'].to_f,
|
45
|
+
:state => c['state'],
|
46
|
+
:name => c['name'],
|
47
|
+
:image_uri => c['image_uri'],
|
48
|
+
:party => c['party'],
|
49
|
+
:district => c['district'],
|
50
|
+
:record_number => c['record_number'],
|
51
|
+
:transaction_type => c['transaction_type'],
|
52
|
+
:transaction_id => c['transaction_id']
|
53
|
+
})}
|
54
|
+
|
45
55
|
end
|
46
|
-
|
56
|
+
|
47
57
|
def self.find(fecid, cycle=CURRENT_CYCLE, candidate=nil)
|
48
58
|
if candidate
|
49
59
|
reply = invoke("#{cycle}/committees/#{fecid}/contributions/candidates/#{candidate}")
|
50
|
-
|
60
|
+
to_candidate(reply)
|
51
61
|
else
|
52
62
|
reply = invoke("#{cycle}/committees/#{fecid}/contributions")
|
53
|
-
|
63
|
+
all_candidates(reply)
|
54
64
|
end
|
55
65
|
end
|
56
66
|
end
|
57
|
-
end
|
67
|
+
end
|
@@ -17,18 +17,18 @@ module CampaignCash
|
|
17
17
|
results = invoke("#{cycle}/electioneering_communications", {:offset => offset})['results']
|
18
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
|
-
|
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
|
-
|
31
|
+
results.map {|obj| ElectioneeringCommunication.create(obj)}
|
32
32
|
end
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
data/lib/campaign_cash/filing.rb
CHANGED
@@ -1,69 +1,68 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class Filing < Base
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :committee_name, :date_coverage_from, :amended_uri, :fec_uri, :date_coverage_to, :committee, :report_title, :amended, :date_filed, :cycle, :form_type, :original_filing, :original_uri, :paper, :committee_type, :filing_id
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(params={})
|
7
7
|
params.each_pair do |k,v|
|
8
8
|
instance_variable_set("@#{k}", v)
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
def self.create(params={})
|
13
|
+
self.new :committee_name => params['committee_name'],
|
14
|
+
:date_coverage_from => date_parser(params['date_coverage_from']),
|
15
|
+
:date_coverage_to => date_parser(params['date_coverage_to']),
|
16
|
+
:committee => parse_committee(params['committee']),
|
17
|
+
:report_title => params['report_title'].strip,
|
18
|
+
:fec_uri => params['fec_uri'],
|
19
|
+
:amended => params['amended'],
|
20
|
+
:amended_uri => params['amended_uri'],
|
21
|
+
:original_filing => params['original_filing'],
|
22
|
+
:original_uri => params['original_uri'],
|
23
|
+
:paper => params['paper'],
|
24
|
+
:form_type => params['form_type'],
|
25
|
+
:filing_id => params['form_id'],
|
26
|
+
:committee_type => Committee.get_committee_type(params['committee_type']),
|
27
|
+
:committee_name => params['committee_name'],
|
28
|
+
:receipts_total => params['receipts_total'],
|
29
|
+
:contributions_total => params['contributions_total'],
|
30
|
+
:disbursements_total => params['disbursements_total'],
|
31
|
+
:cash_on_hand => params['cash_on_hand']
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.today(offset=nil)
|
35
|
+
cycle=CURRENT_CYCLE
|
36
|
+
reply = Base.invoke("#{cycle}/filings", {:offset => offset})
|
37
|
+
results = reply['results']
|
38
|
+
results.map{|c| Filing.create(c)}
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.date(year, month, day, offset=nil)
|
42
|
+
cycle = cycle_from_date(Date.strptime("#{month}/#{day}/#{year}", '%m/%d/%Y'))
|
43
|
+
reply = Base.invoke("#{cycle}/filings/#{year}/#{month}/#{day}", {:offset => offset})
|
44
|
+
results = reply['results']
|
45
|
+
results.map{|c| Filing.create(c)}
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.form_types
|
49
|
+
cycle=CURRENT_CYCLE
|
50
|
+
reply = Base.invoke("#{cycle}/filings/types",{})
|
51
|
+
results = reply['results']
|
52
|
+
results.map{|ft| OpenStruct.new({:id => ft['id'], :name => ft['name'].strip})}
|
53
|
+
end
|
11
54
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
:committee_type => Committee.get_committee_type(params['committee_type'])
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.create_from_filings(params={})
|
30
|
-
self.new :date_coverage_from => date_parser(params['date_coverage_from']),
|
31
|
-
:date_coverage_to => date_parser(params['date_coverage_to']),
|
32
|
-
:report_title => params['report_title'].strip,
|
33
|
-
:fec_uri => params['fec_uri'],
|
34
|
-
:amended => params['amended'],
|
35
|
-
:amended_uri => params['amended_uri'],
|
36
|
-
:cycle => params['cycle'],
|
37
|
-
:form_type => params['form_type'],
|
38
|
-
:date_filed => date_parser(params['date_filed'])
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
def self.today(offset=nil)
|
43
|
-
cycle=CURRENT_CYCLE
|
44
|
-
reply = Base.invoke("#{cycle}/filings", {:offset => offset})
|
45
|
-
results = reply['results']
|
46
|
-
results.map{|c| Filing.create(c)}
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.date(year, month, day, offset=nil)
|
50
|
-
cycle = cycle_from_date(Date.strptime("#{month}/#{day}/#{year}", '%m/%d/%Y'))
|
51
|
-
reply = Base.invoke("#{cycle}/filings/#{year}/#{month}/#{day}", {:offset => offset})
|
52
|
-
results = reply['results']
|
53
|
-
results.map{|c| Filing.create(c)}
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.form_types
|
57
|
-
cycle=CURRENT_CYCLE
|
58
|
-
reply = Base.invoke("#{cycle}/filings/types",{})
|
59
|
-
results = reply['results']
|
60
|
-
results.map{|ft| OpenStruct.new({:id => ft['id'], :name => ft['name'].strip})}
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.by_type(cycle, form_type)
|
64
|
-
reply = Base.invoke("#{cycle}/filings/types/#{form_type}")
|
65
|
-
results = reply['results']
|
66
|
-
results.map{|c| Filing.create(c)}
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
55
|
+
def self.amendments(offset=nil)
|
56
|
+
cycle=CURRENT_CYCLE
|
57
|
+
reply = Base.invoke("#{cycle}/filings/amendments", {:offset => offset})
|
58
|
+
results = reply['results']
|
59
|
+
results.map{|c| Filing.create(c)}
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.by_type(cycle, form_type)
|
63
|
+
reply = Base.invoke("#{cycle}/filings/types/#{form_type}")
|
64
|
+
results = reply['results']
|
65
|
+
results.map{|c| Filing.create(c)}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class FilingSummary < Base
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :pac_contributions_period, :contributions_2500, :party_contributions_cycle, :fundraising_offsets_period, :primary_general, :pac_refunds_cycle, :party_refunds_cycle, :fundraising_expenses_period, :net_party_contributions, :num_contributions_200_499, :individual_refunds_cycle, :candidate_contributions_period, :legal_offsets_cycle, :num_contributions_500_1499, :net_operating_expenses, :total_debts_owed, :refunds_200_499, :refunds_1500_2499, :transfers_out_period, :net_primary, :liquidate_period, :contributions_200_499, :operating_offsets_cycle, :num_contributions_1500_2499, :candidate_loan_repayments_period, :committee_uri, :federal_funds_cycle, :net_candidate_contributions, :candidate_loans_period, :filing_id, :net_pac_contributions, :num_refunds_200_499, :candidate_loan_repayments_cycle, :total_offsets_cycle, :party_contributions_period, :net_individual_contributions, :num_refunds_1500_2499, :net_general, :total_receipts_cycle, :federal_funds_period, :transfers_out_cycle, :cycle, :other_loan_repayments_period, :contributions_500_1499, :legal_offsets_period, :date_coverage_from, :contributions_less_than_200, :fec_form_type, :candidate_contributions_cycle, :cash_on_hand_beginning, :individual_refunds_period, :fundraising_expenses_cycle, :num_refunds_500_1499, :cash_on_hand_close, :num_contributions_less_than_200, :total_loans_cycle, :candidate_uri, :contributions_1500_2499, :refunds_2500, :flag_most_current_report, :total_loan_repayments_period, :other_loans_period, :operating_expenditures_cycle, :other_disbursements_period, :total_loans_period, :transfers_in_period, :transfers_in_cycle, :report, :legal_expenses_period, :candidate_loans_cycle, :individual_contributions_period, :other_disbursements_cycle, :total_disbursements_period, :other_loans_cycle, :net_transfers_in, :net_disbursements, :operating_expenditures_period, :fundraising_offsets_cycle, :date_coverage_to, :total_loan_repayments_cycle, :total_disbursements_cycle, :party_refunds_period, :individual_contributions_cycle, :net_total_contributions, :other_loan_repayments_cycle, :total_refunds_cycle, :total_receipts_period, :total_offsets_period, :total_contributions_period, :total_contributions_cycle, :refunds_500_1499, :pac_refunds_period, :flag_valid_report, :legal_expenses_cycle, :num_refunds_less_than_200, :refunds_less_than_200, :pac_contributions_cycle, :net_legal_expenses, :net_fundraising_expenses, :num_contributions_2500, :total_refunds_period, :operating_offsets_period, :num_refunds_2500
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(params={})
|
7
7
|
params.each_pair do |k,v|
|
8
8
|
instance_variable_set("@#{k}", v)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
|
12
|
+
def self.create(params={})
|
13
|
+
self.new(params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.by_id(id)
|
17
17
|
cycle = CURRENT_CYCLE
|
18
18
|
result = FilingSummary.create(Base.invoke("#{cycle}/filings/#{id}")["results"])
|
19
19
|
end
|
data/lib/campaign_cash/form.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
module CampaignCash
|
2
2
|
class Form < Base
|
3
|
-
|
3
|
+
|
4
4
|
attr_reader :id, :name
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(params={})
|
7
7
|
params.each_pair do |k,v|
|
8
8
|
instance_variable_set("@#{k}", v)
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
def self.create(params={})
|
13
13
|
self.new :id => params['id'],
|
14
|
-
|
14
|
+
:name => params['name']
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def self.form_types
|
18
18
|
reply = Base.invoke("#{Base::CURRENT_CYCLE}/filings/types")
|
19
19
|
results = reply['results']
|
20
20
|
@forms = results.map{|c| Form.create(c)}
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|