Class: Google::Civic::Client
- Inherits:
-
Object
- Object
- Google::Civic::Client
- Defined in:
- lib/google-civic/client.rb
Instance Method Summary collapse
- #elections(zipcode) ⇒ Object
-
#initialize(api_key, connection) ⇒ Client
constructor
A new instance of Client.
- #representative_info(address) ⇒ Object
- #request(*args) ⇒ Object
- #voter_info(address) ⇒ Object
Constructor Details
#initialize(api_key, connection) ⇒ Client
4 5 6 7 |
# File 'lib/google-civic/client.rb', line 4 def initialize(api_key, connection) @api_key = api_key @connection = connection end |
Instance Method Details
#elections(zipcode) ⇒ Object
9 10 11 |
# File 'lib/google-civic/client.rb', line 9 def elections(zipcode) Elections.for_zipcode(zipcode, self) end |
#representative_info(address) ⇒ Object
13 14 15 |
# File 'lib/google-civic/client.rb', line 13 def representative_info(address) RepresentativeInfo.for_address(address, self) end |
#request(*args) ⇒ Object
21 22 23 24 |
# File 'lib/google-civic/client.rb', line 21 def request(*args) @request ||= {} @request[args] ||= Requester.new(connection, { key: api_key }).request(*args) end |
#voter_info(address) ⇒ Object
17 18 19 |
# File 'lib/google-civic/client.rb', line 17 def voter_info(address) VoterInfo.for_address(address, self) end |