campaign_cash 2.2.1 → 2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -12,6 +12,7 @@ Simple ruby wrapper for The New York Times Campaign Finance API[http://developer
12
12
 
13
13
  == News
14
14
 
15
+ * March 15, 2012: Version 2.3 released. Added committee_type to Filing objects and offset to Candidate methods.
15
16
  * March 9, 2012: Version 2.2.1 released. Added transfers_in attribute to President#detail.
16
17
  * Feb. 8, 2012: Version 2.1.0 released. Added better support for independent expenditures and FilingSummary class for presidential candidate filings.
17
18
  * Jan. 28, 2012: Version 2.0.8 released. Bugfix for Candidate#search. Thanks to @benjaminjackson for patch.
@@ -113,25 +113,25 @@ module CampaignCash
113
113
 
114
114
  # Returns an array of candidates matching a search term within a cycle. Defaults to the
115
115
  # current cycle.
116
- def self.search(name, cycle=CURRENT_CYCLE)
117
- reply = invoke("#{cycle}/candidates/search", {:query => name})
116
+ def self.search(name, cycle=CURRENT_CYCLE, offset=nil)
117
+ reply = invoke("#{cycle}/candidates/search", {:query => name, :offset => offset})
118
118
  results = reply['results']
119
119
  results.map{|c| self.create_from_search_results(c)}
120
120
  end
121
121
 
122
122
  # Returns an array of newly created FEC candidates within a current cycle. Defaults to the
123
123
  # current cycle.
124
- def self.new_candidates(cycle=CURRENT_CYCLE)
125
- reply = invoke("#{cycle}/candidates/new",{})
124
+ def self.new_candidates(cycle=CURRENT_CYCLE, offset=nil)
125
+ reply = invoke("#{cycle}/candidates/new",{:offset => offset})
126
126
  results = reply['results']
127
127
  results.map{|c| self.create(c)}
128
128
  end
129
129
 
130
130
  # Returns an array of candidates for a given state and chamber within a cycle, with an optional
131
131
  # district parameter. For example, House candidates from New York. Defaults to the current cycle.
132
- def self.state_chamber(state, chamber, district=nil, cycle=CURRENT_CYCLE)
132
+ def self.state_chamber(state, chamber, district=nil, cycle=CURRENT_CYCLE, offset=nil)
133
133
  district ? path = "#{cycle}/seats/#{state}/#{chamber}/#{district}" : path = "#{cycle}/seats/#{state}/#{chamber}"
134
- reply = invoke(path,{})
134
+ reply = invoke(path,{:offset => offset})
135
135
  results = reply['results']
136
136
  results.map{|c| self.create_from_search_results(c)}
137
137
  end
@@ -83,7 +83,7 @@ module CampaignCash
83
83
  :candidate_id => parse_candidate(params['candidate']),
84
84
  :filing_frequency => get_frequency(params['filing_frequency']),
85
85
  :interest_group => get_interest_group(params['interest_group']),
86
- :committee_type => get_committee_type(params['get_committee_type']),
86
+ :committee_type => get_committee_type(params['committee_type']),
87
87
  :designation => get_designation(params['designation']),
88
88
  :other_cycles => params['other_cycles'].map{|cycle| cycle['cycle']['fec_committee']['cycle']}
89
89
  end
@@ -1,7 +1,7 @@
1
1
  module CampaignCash
2
2
  class Filing < Base
3
3
 
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
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
5
5
 
6
6
  def initialize(params={})
7
7
  params.each_pair do |k,v|
@@ -21,7 +21,8 @@ module CampaignCash
21
21
  :original_filing => params['original_filing'],
22
22
  :original_uri => params['original_uri'],
23
23
  :paper => params['paper'],
24
- :form_type => params['form_type']
24
+ :form_type => params['form_type'],
25
+ :committee_type => Committee.get_committee_type(params['committee_type'])
25
26
  end
26
27
 
27
28
  def self.create_from_filings(params={})
@@ -1,3 +1,3 @@
1
1
  module CampaignCash
2
- VERSION = "2.2.1"
2
+ VERSION = "2.3"
3
3
  end
@@ -56,8 +56,8 @@ class TestCampaignCash::TestCommittee < Test::Unit::TestCase
56
56
  @filings = results.map{|f| Filing.create(f)}
57
57
  end
58
58
 
59
- should "return 11 filings" do
60
- assert_equal @filings.size, 11
59
+ should "return 8 filings" do
60
+ assert_equal @filings.size, 8
61
61
  end
62
62
  end
63
63
 
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 2
9
- - 1
10
- version: 2.2.1
8
+ - 3
9
+ version: "2.3"
11
10
  platform: ruby
12
11
  authors:
13
12
  - Derek Willis
@@ -15,8 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-03-09 00:00:00 -05:00
19
- default_executable:
17
+ date: 2012-03-15 00:00:00 Z
20
18
  dependencies:
21
19
  - !ruby/object:Gem::Dependency
22
20
  name: json
@@ -118,7 +116,6 @@ files:
118
116
  - test/campaign_cash/test_individual_contribution.rb
119
117
  - test/campaign_cash/test_president.rb
120
118
  - test/test_helper.rb
121
- has_rdoc: true
122
119
  homepage: http://rubygems.org/gems/campaign_cash
123
120
  licenses: []
124
121
 
@@ -150,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
147
  requirements: []
151
148
 
152
149
  rubyforge_project: campaign_cash
153
- rubygems_version: 1.6.2
150
+ rubygems_version: 1.8.17
154
151
  signing_key:
155
152
  specification_version: 3
156
153
  summary: Following the money.