1 class QuickVoteStruct < ActionWebService::Struct
3 member :description, :string
4 member :candidate_ids, [:int]
5 member :candidate_names, [:string]
8 class QuickVoterInfo < ActionWebService::Struct
10 member :voter_session_id, :string
11 member :voter_ipaddress, :string
12 member :vote_time, :int
16 class QuickVoteResultStruct < ActionWebService::Struct
17 member :plurality_winners, [:int]
18 member :approval_winners, [:int]
19 member :condorcet_winners, [:int]
20 member :ssd_winners, [:int]
21 member :borda_winners, [:int]
23 class QuickVoteCandidateMap < ActionWebService::Struct
24 member :candidate_ids, [:int]
25 member :candidate_names, [:string]
29 ## An API for interfacing with Selectricity
30 ## This allows for things like XML-RPC to have a unified interface
31 ## The implementation is elsewhere.
32 class SelectricityAPI < ActionWebService::API::Base
34 ## Expects a quickvote name, a voter ID, and a list of candidate ID's respectively.
35 ## Returns a string containing any potential errors that occurred in the process.
36 api_method :cast_quickvote, :expects => [:string, :int, [[:int]]], :returns => [:string]
37 ## Return the results of a QuickVote.
38 ## Takes in the name of a quickvote, and returns a structure as described by
39 ## QuickVoteResultStruct
40 api_method :get_quickvote_results, :expects => [:string], :returns => [QuickVoteResultStruct]
41 ## Returns information regarding all the candidates in a QuickVote
42 ## Takes in a QuickVote name, and returns the list of names and ID's of candidates
43 ## This can be useful for presenting the user with a list of readable names, while
44 ## the software sends results to us in the numeric ID's we require. The two lists are in
46 api_method :get_quickvote_candidate_map, :expects => [:string], :returns => [QuickVoteCandidateMap]
47 ## Converts QuickVote candidate ID's to names
48 ## Takes in a QuickVote name and a list of candidate ID's, and returns the names of
49 ## each candidate. Useful for doing just a few lookups; it's more efficient to use
50 ## get_quickvote_candidate_map for presenting info about an entire election.
51 api_method :quickvote_candidate_ids_to_names, :expects => [:string,[:int]], :returns => [[:string]]
52 ## Get information on all the votes cast in a QuickVote
53 ## Takes in the name of a QuickVote, returns an array of QuickVoterInfo structures.
54 api_method :get_quickvote_votes, :expects => [:string], :returns => [ [QuickVoterInfo] ]
55 ## Gets a list of all QuickVotes in the system.
56 api_method :list_quickvotes, :expects => [], :returns => [[QuickVoteStruct]]
57 ## Gets information on a particular QuickVote
58 ## Takes in a QuickVote name
59 api_method :get_quickvote, :expects => [:string], :returns => [QuickVoteStruct]
61 ## Pass in a QuickVoteStruct populated with all the fields but the candidate ID's
62 api_method :create_quickvote, :expects => [QuickVoteStruct], :returns => [:string]