Class: OpenCivicData::Client
- Inherits:
-
Object
- Object
- OpenCivicData::Client
- Includes:
- Connection, Request
- Defined in:
- lib/open_civic_data/client.rb
Constant Summary
Constants included from Connection
OpenCivicData::Connection::ENDPOINT
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#bills(options = {}) ⇒ Hashie::Rash
Fetches legislative documents and their history.
-
#divisions(options = {}) ⇒ Hashie::Rash
Fetches political geographies such as a state, county or congressional district.
-
#events(options = {}) ⇒ Hashie::Rash
Fetches legislative event, such as a meeting or hearing.
-
#initialize(key) ⇒ Client
constructor
A new instance of Client.
-
#jurisdictions(options = {}) ⇒ Hashie::Rash
Fetches governing bodies that exist within a division.
-
#organizations(options = {}) ⇒ Hashie::Rash
Fetches groups of people, such as a city council, state senate or committee.
-
#people(options = {}) ⇒ Hashie::Rash
Fetches people, typically politicians or gov officials.
-
#votes(options = {}) ⇒ Hashie::Rash
Fetches the record of vote taken on motions.
Methods included from Request
Constructor Details
#initialize(key) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/open_civic_data/client.rb', line 11 def initialize(key) fail ArgumentError, 'API key required' if key.nil? @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
9 10 11 |
# File 'lib/open_civic_data/client.rb', line 9 def key @key end |
Instance Method Details
#bills(options = {}) ⇒ Hashie::Rash
Fetches legislative documents and their history
72 73 74 |
# File 'lib/open_civic_data/client.rb', line 72 def bills( = {}) get('/bills/', ) end |
#divisions(options = {}) ⇒ Hashie::Rash
Fetches political geographies such as a state, county or congressional district
32 33 34 |
# File 'lib/open_civic_data/client.rb', line 32 def divisions( = {}) get('/divisions/', ) end |
#events(options = {}) ⇒ Hashie::Rash
Fetches legislative event, such as a meeting or hearing
62 63 64 |
# File 'lib/open_civic_data/client.rb', line 62 def events( = {}) get('/events/', ) end |
#jurisdictions(options = {}) ⇒ Hashie::Rash
Fetches governing bodies that exist within a division
22 23 24 |
# File 'lib/open_civic_data/client.rb', line 22 def jurisdictions( = {}) get('/jurisdictions/', ) end |
#organizations(options = {}) ⇒ Hashie::Rash
Fetches groups of people, such as a city council, state senate or committee
52 53 54 |
# File 'lib/open_civic_data/client.rb', line 52 def organizations( = {}) get('/organizations/', ) end |
#people(options = {}) ⇒ Hashie::Rash
Fetches people, typically politicians or gov officials
42 43 44 |
# File 'lib/open_civic_data/client.rb', line 42 def people( = {}) get('/people/', ) end |
#votes(options = {}) ⇒ Hashie::Rash
Fetches the record of vote taken on motions
82 83 84 |
# File 'lib/open_civic_data/client.rb', line 82 def votes( = {}) get('/votes/', ) end |