lib/vote_smart/official.rb in netroots-ruby-votesmart-0.2.0 vs lib/vote_smart/official.rb in netroots-ruby-votesmart-0.2.1

- old
+ new

@@ -1,26 +1,28 @@ module VoteSmart class Official < Common attr_accessor :id, :first_name, :nick_name, :middle_name, :last_name, :suffix, :title, - :election_parties, :office_parties, :district_id, :district_name, :state_id + :election_parties, :office_parties, :district_id, :district_name, :state_id, :district set_attribute_map "candidateId" => :id, "firstName" => :first_name, "nickName" => :nick_name, "middleName" => :middle_name, "lastName" => :last_name, "suffix" => :suffix, "title" => :title, "electionParties" => :election_parties, "officeDistrictId" => :district_id, "officeDistrictName" => :district_name, "officeStateId" => :state_id def offices - Official.response_child(Address.get_office(self.id), "address", "office").collect {|office| CandidateOffice.new(office) } + Official.response_child_array(Address.get_office(self.id), "address", "office").collect {|office| CandidateOffice.new(office) } end def inspect "Official: " + [title, first_name, last_name].compact.join(' ') end def self.find_by_district district - find_by_district_id district.id + official = find_by_district_id district.id + official.district = district if official + official end def self.find_by_district_id district_id response = response_child(get_by_district(district_id), "candidateList", "candidate") Official.new(response) unless response.empty?