Class: OpenCivicData::Client

Inherits:
Object
  • Object
show all
Includes:
Connection, Request
Defined in:
lib/open_civic_data/client.rb

Constant Summary

Constants included from Connection

OpenCivicData::Connection::ENDPOINT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

#get

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)
  warn 'Warning: Your API key may not be set.' if key.nil?
  @key = key
end

Instance Attribute Details

#keyObject (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

Legislative documents, resolutions, appointments or contract and its history, Bill's type, legislative body, session, name, chamber, title, type, subject and summary.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.bills

Returns:

  • (Hashie::Rash)


78
79
80
# File 'lib/open_civic_data/client.rb', line 78

def bills(options = {})
  get('/bills/', options)
end

#divisions(options = {}) ⇒ Hashie::Rash

Divisions are political geographies such as a state, county, or congressional district. Division's geometries and list of child jurisdiction ids.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.divisions

Returns:

  • (Hashie::Rash)


34
35
36
# File 'lib/open_civic_data/client.rb', line 34

def divisions(options = {})
  get('/divisions/', options)
end

#events(options = {}) ⇒ Hashie::Rash

A legislative event, such as a meeting or hearing. Event's type, name, description, when, end, status, location, and linked entities.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.events

Returns:

  • (Hashie::Rash)


67
68
69
# File 'lib/open_civic_data/client.rb', line 67

def events(options = {})
  get('/events/', options)
end

#jurisdictions(options = {}) ⇒ Object

Jurisdictions are governing bodies that exists within a division. Jurisdiction's name, url, chambers, terms, and session details.

return [Hashie::Rash]

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.jurisdictions


23
24
25
# File 'lib/open_civic_data/client.rb', line 23

def jurisdictions(options = {})
  get('/jurisdictions/', options)
end

#organizations(options = {}) ⇒ Hashie::Rash

A group of people, such as a city council, state senate, or committee. Organization's name, classification, parent id, contact details, links and posts.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.organizations

Returns:

  • (Hashie::Rash)


56
57
58
# File 'lib/open_civic_data/client.rb', line 56

def organizations(options = {})
  get('/organizations/', options)
end

#people(options = {}) ⇒ Hashie::Rash

People, typically a politician or gov official. Person's name, image, contact details, and links.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.people

Returns:

  • (Hashie::Rash)


45
46
47
# File 'lib/open_civic_data/client.rb', line 45

def people(options = {})
  get('/people/', options)
end

#votes(options = {}) ⇒ Hashie::Rash

The record of a vote taken on a motion. May contain individual legilsator's yay/nay or outcome. Vote's organization, session, chamber, date, motion, type and passed or not.

Examples:

OpenCivicData.key = YOUR_SUNLIGHT_API_KEY
OpenCivicData.votes

Returns:

  • (Hashie::Rash)


89
90
91
# File 'lib/open_civic_data/client.rb', line 89

def votes(options = {})
  get('/votes/', options)
end