Class: OpenFec::Resources::ContributionAggregates
- Defined in:
- lib/open_fec/resources/contribution_aggregates.rb
Overview
Aggregated contribution data (by employer, occupation, size, state, zip). All endpoints use offset-based pagination.
Instance Method Summary collapse
-
#by_employer(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by employer.
-
#by_occupation(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by occupation.
-
#by_size(candidate_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by size (small/medium/large dollar).
-
#by_state(candidate_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by state.
-
#by_zip(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by zip code.
-
#each_employer_page(committee_id:, cycle:, **params) {|OpenFec::Response| ... } ⇒ Object
Paginate through employer contribution aggregates.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OpenFec::Resources::Base
Instance Method Details
#by_employer(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by employer. Returns: employer, total, count, cycle.
25 26 27 28 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 25 def by_employer(committee_id:, cycle:, **params) get('schedules/schedule_a/by_employer/', params.merge(committee_id: committee_id, cycle: cycle)) end |
#by_occupation(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by occupation.
36 37 38 39 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 36 def by_occupation(committee_id:, cycle:, **params) get('schedules/schedule_a/by_occupation/', params.merge(committee_id: committee_id, cycle: cycle)) end |
#by_size(candidate_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by size (small/medium/large dollar).
47 48 49 50 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 47 def by_size(candidate_id:, cycle:, **params) get('schedules/schedule_a/by_size/by_candidate/', params.merge(candidate_id: candidate_id, cycle: cycle)) end |
#by_state(candidate_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by state.
58 59 60 61 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 58 def by_state(candidate_id:, cycle:, **params) get('schedules/schedule_a/by_state/by_candidate/', params.merge(candidate_id: candidate_id, cycle: cycle)) end |
#by_zip(committee_id:, cycle:, **params) ⇒ OpenFec::Response
Contributions aggregated by zip code. Returns: zip, total, count, cycle.
70 71 72 73 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 70 def by_zip(committee_id:, cycle:, **params) get('schedules/schedule_a/by_zip/', params.merge(committee_id: committee_id, cycle: cycle)) end |
#each_employer_page(committee_id:, cycle:, **params) {|OpenFec::Response| ... } ⇒ Object
Paginate through employer contribution aggregates.
81 82 83 84 |
# File 'lib/open_fec/resources/contribution_aggregates.rb', line 81 def each_employer_page(committee_id:, cycle:, **params, &) client.paginate('schedules/schedule_a/by_employer/', params.merge(committee_id: committee_id, cycle: cycle), &) end |