Class: CivicAide::Elections
- Inherits:
-
Object
- Object
- CivicAide::Elections
- Defined in:
- lib/civic_aide/elections.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#election_id ⇒ Object
readonly
Returns the value of attribute election_id.
Instance Method Summary collapse
- #all ⇒ Object
- #at(address) ⇒ Object
-
#initialize(client, election_id = nil) ⇒ Elections
constructor
A new instance of Elections.
Constructor Details
#initialize(client, election_id = nil) ⇒ Elections
Returns a new instance of Elections.
5 6 7 8 |
# File 'lib/civic_aide/elections.rb', line 5 def initialize(client, election_id=nil) @client = client @election_id = election_id end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/civic_aide/elections.rb', line 3 def client @client end |
#election_id ⇒ Object (readonly)
Returns the value of attribute election_id.
3 4 5 |
# File 'lib/civic_aide/elections.rb', line 3 def election_id @election_id end |
Instance Method Details
#all ⇒ Object
10 11 12 13 |
# File 'lib/civic_aide/elections.rb', line 10 def all response = client.get('/elections') response.except!(:kind) end |
#at(address) ⇒ Object
15 16 17 18 19 |
# File 'lib/civic_aide/elections.rb', line 15 def at(address) raise ElectionIdMissing, "Missing a required election id" if @election_id.nil? response = client.post("/voterinfo/#{election_id}/lookup", {officialOnly: @client.official_only}, {address: address}) response.except!(:kind, :status) end |