Permalink
Browse files

more IE support and cleanup

  • Loading branch information...
1 parent cbeae5a commit 8a71315d604d1b12f90a7c8a6693d0c4641aa07d @dwillis dwillis committed Dec 15, 2011
Showing with 27 additions and 16 deletions.
  1. +1 −10 Rakefile
  2. +25 −3 lib/campaign_cash/independent_expenditure.rb
  3. +1 −1 lib/campaign_cash/version.rb
  4. +0 −2 test/test_helper.rb
View
@@ -1,4 +1,5 @@
require 'bundler'
+include Rake::DSL
Bundler::GemHelper.install_tasks
require 'rake/testtask'
@@ -9,13 +10,3 @@ Rake::TestTask.new(:test) do |test|
end
task :default => :test
-
-require 'rake/rdoctask'
-Rake::RDocTask.new do |rdoc|
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
-
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "campaign_cash #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
@@ -1,7 +1,7 @@
module CampaignCash
class IndependentExpenditure < Base
- attr_reader :fec_committee, :district, :state, :fec_committee_name, :purpose, :fec_candidate, :support_or_oppose, :date, :amount, :office, :amendment, :date_received, :payee, :fec_uri
+ attr_reader :fec_committee_id, :district, :state, :fec_committee_name, :purpose, :fec_candidate_id, :support_or_oppose, :date, :amount, :office, :amendment, :date_received, :payee, :fec_uri
def initialize(params={})
params.each_pair do |k,v|
@@ -10,14 +10,36 @@ def initialize(params={})
end
def self.create(params={})
- self.new :id => params['id'],
- :name => params['name']
+ self.new :fec_committee_id => params['fec_committee'].split('/').last.split('.').first,
+ :fec_committee_name => params['fec_committee_name'],
+ :fec_candidate_id => params['fec_candidate'].split('/').last.split('.').first,
+ :office => params['office'],
+ :state => params['state'].strip,
+ :district => params['district'],
+ :date => date_parser(params['date']),
+ :support_or_oppose => params['support_or_oppose'],
+ :payee => params['payee'],
+ :purpose => params['purpose'],
+ :amount => params['amount'],
+ :fec_uri => params['fec_uri'],
+ :date_received => date_parser(params['date_received'])
end
def self.latest
reply = Base.invoke("#{Base::CURRENT_CYCLE}/independent_expenditures")
results = reply['results']
@independent_expenditures = results.map{|c| IndependentExpenditure.create(c)}
end
+
+ def self.date(cycle, date)
+ d = Date.parse(date)
+ reply = Base.invoke("cycle/independent_expenditures/#{d.year}/#{d.month}/#{d.day}")
+ results = reply['results']
+ @independent_expenditures = results.map{|c| IndependentExpenditure.create(c)}
+
+
+ end
+
+
end
end
@@ -1,3 +1,3 @@
module CampaignCash
- VERSION = "1.3"
+ VERSION = "1.5"
end
View
@@ -8,8 +8,6 @@
require File.join(File.dirname(__FILE__), '../lib/campaign_cash', f)
end
-include CampaignCash
-
# set your NYT Campaign Finance API key as an environment variable to run the tests
API_KEY = ENV['NYT_CAMPFIN_API_KEY']
CampaignCash::Base.api_key = API_KEY

0 comments on commit 8a71315

Please sign in to comment.