-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add voter list importation usage instructions
- Loading branch information
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,27 @@ Alternatively, you can still pass the API key directly during initialization. If | |
client = ElectionBuddy::Client.new(api_key: 'your-api-key') | ||
``` | ||
|
||
### Voter List Importation | ||
|
||
To import a voter list for an election, use the `voter_list.import(vote_id, voters, append_mode: false)` method: | ||
|
||
```ruby | ||
voters = [ | ||
{ email: '[email protected]', label: 'Voter One' }, | ||
{ email: '[email protected]', label: 'Voter Two' } | ||
] | ||
|
||
import = client.voter_list.import(1, voters, append_mode: false) | ||
|
||
if import.done? | ||
puts "Import completed successfully! Identifier: #{import.identifier}" | ||
else | ||
puts "Import failed: #{import.error}" | ||
end | ||
``` | ||
|
||
The `append_mode` parameter determines whether the voters should be appended to the existing list (`true`) or replace the existing list (`false`). The default value is `false`. | ||
|
||
### Voter List Validation | ||
|
||
To validate a voter list, use the `voter_list.validate(vote_id)` method: | ||
|