Skip to content

Commit

Permalink
Add voter list importation usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
betogrun committed Nov 19, 2024
1 parent 041b54b commit ce579d3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ce579d3

Please sign in to comment.