Class: GovKit::FollowTheMoney::SectorContribution

Inherits:
Contribution show all
Defined in:
lib/gov_kit/follow_the_money.rb

Overview

Wrap contributions by sector to a candidate. See the FollowTheMoney API.

Instance Attribute Summary

Attributes inherited from Resource

#attributes, #raw_response

Class Method Summary collapse

Methods inherited from Contribution

top

Methods inherited from GovKit::FollowTheMoneyResource

get_xml, stringify_values_of

Methods inherited from Resource

#initialize, instantiate, instantiate_collection, parse, #to_md5, #unload

Constructor Details

This class inherits a constructor from GovKit::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GovKit::Resource

Class Method Details

.find(nimsp_id) ⇒ [Contribution]

Return conributions by sector.

Parameters:

  • nimsp_id (Integer)

    the candidate id.

Returns:



151
152
153
154
155
156
157
158
# File 'lib/gov_kit/follow_the_money.rb', line 151

def self.find(nimsp_id)
  doc = get_xml("/candidates.sectors.php", :query => {"imsp_candidate_id" => nimsp_id})

  result = doc.search('//candidate_sector').collect { |x| x.attributes }

  stringify_values_of(result)
  parse(result)
end