Skip to content

Instantly share code, notes, and snippets.

@bycoffe
Created June 10, 2012 18:25
Show Gist options
  • Save bycoffe/2906827 to your computer and use it in GitHub Desktop.
Save bycoffe/2906827 to your computer and use it in GitHub Desktop.
Fech::Search example
require 'fech'
search = Fech::Search.new(date: Date.today, form_type: 'F6')
search.results.sort_by { |x| -x.filing_id.to_i }.each do |result|
filing = Fech::Filing.new(result.filing_id, :csv_parser => Fech::CsvDoctor)
filing.download unless File.exists? filing.file_path
filing.rows_like(/f65/) do |row|
p [filing.filing_id,
filing.summary.committee_name,
row.contributor_last_name,
row.contributor_first_name,
row.contributor_middle_name,
row.contributor_employer,
row.contributor_organization_name,
row.contribution_amount,
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment