member :condorcet_winners, [:int]
member :ssd_winners, [:int]
member :borda_winners, [:int]
+ member :errors, [:string]
+end
+class CandidateMap < ActionWebService::Struct
member :candidate_ids, [:int]
member :candidate_names, [:string]
member :errors, [:string]
class SelectricityAPI < ActionWebService::API::Base
api_method :cast_quickvote, :expects => [:int, :int, [[:int]]], :returns => [:string]
api_method :get_quickvote_results, :expects => [:string], :returns => [VoteResultStruct]
+ api_method :get_quickvote_candidate_map, :expects => [:string], :returns => [CandidateMap]
end
result.condorcet_winners=qv.condorcet_result.winners
result.ssd_winners=qv.ssd_result.winners
result.borda_winners=qv.borda_result.winners
+ result
+ end
+ def get_quickvote_candidate_map(shortname)
+ qv=QuickVote.ident_to_quickvote(shortname)
+ result=CandidateMap.new
+ result.errors=[]
+ unless qv
+ result.errors << "No quickvote with name #{shortname} found!"
+ return result
+ end
candidates={}
qv.candidates.each {|c| candidates[c.id] = c.name}
result.candidate_ids=candidates.keys
result.candidate_names=candidates.values
result
end
+
end