Class: OpenFec::Resources::Candidates
- Defined in:
- lib/open_fec/resources/candidates.rb
Overview
Search and retrieve FEC candidate records.
Instance Method Summary collapse
-
#committees(candidate_id, **params) ⇒ OpenFec::Response
List committees associated with a candidate.
-
#each_page(**params) {|OpenFec::Response| ... } ⇒ Object
Paginate through candidate search results (offset-based).
-
#find(candidate_id) ⇒ OpenFec::Response
Fetch a single candidate by FEC candidate ID.
-
#search(**params) ⇒ OpenFec::Response
Search for candidates by name, state, district, party, etc.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OpenFec::Resources::Base
Instance Method Details
#committees(candidate_id, **params) ⇒ OpenFec::Response
List committees associated with a candidate.
36 37 38 |
# File 'lib/open_fec/resources/candidates.rb', line 36 def committees(candidate_id, **params) get("candidate/#{candidate_id}/committees/", params) end |
#each_page(**params) {|OpenFec::Response| ... } ⇒ Object
Paginate through candidate search results (offset-based).
44 45 46 |
# File 'lib/open_fec/resources/candidates.rb', line 44 def each_page(**params, &) client.paginate('candidates/search/', params, &) end |
#find(candidate_id) ⇒ OpenFec::Response
Fetch a single candidate by FEC candidate ID. Includes principal_committees in the response.
27 28 29 |
# File 'lib/open_fec/resources/candidates.rb', line 27 def find(candidate_id) get("candidate/#{candidate_id}/") end |
#search(**params) ⇒ OpenFec::Response
Search for candidates by name, state, district, party, etc.
18 19 20 |
# File 'lib/open_fec/resources/candidates.rb', line 18 def search(**params) get('candidates/search/', params) end |