Class: Congress::Client

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

Constant Summary

Constants included from Connection

Congress::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
# File 'lib/congress/client.rb', line 11

def initialize(key)
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/congress/client.rb', line 9

def key
  @key
end

Instance Method Details

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

Legislation in the House and Senate, back to 2009. Updated daily.

Examples:

client.bills

Returns:

  • (Hashie::Rash)


60
61
62
# File 'lib/congress/client.rb', line 60

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

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

Full text search over legislation.

Examples:

client.bills_search

Returns:

  • (Hashie::Rash)


69
70
71
# File 'lib/congress/client.rb', line 69

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

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

Current committees, subcommittees, and their membership.

Examples:

client.committees

Returns:

  • (Hashie::Rash)


51
52
53
# File 'lib/congress/client.rb', line 51

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

#districts_locate(*args) ⇒ Hashie::Rash

Find congressional districts for a latitude/longitude, zip, or address.

Examples:

client.districts_locate('94107')
client.districts_locate(37.775, -122.418)
client.districts_locate('2169 Mission Street, San Francisco, CA 94110')

Returns:

  • (Hashie::Rash)


42
43
44
# File 'lib/congress/client.rb', line 42

def districts_locate(*args)
  get('/districts/locate', extract_location(args))
end

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

To-the-minute updates from the floor of the House and Senate.

Examples:

client.floor_updates

Returns:

  • (Hashie::Rash)


87
88
89
# File 'lib/congress/client.rb', line 87

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

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

Committee hearings in client. Updated as hearings are announced.

Examples:

client.hearings

Returns:

  • (Hashie::Rash)


96
97
98
# File 'lib/congress/client.rb', line 96

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

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

Current legislators' names, IDs, biography, and social media.

Examples:

client.legislators

Returns:

  • (Hashie::Rash)


20
21
22
# File 'lib/congress/client.rb', line 20

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

#legislators_locate(*args) ⇒ Hashie::Rash

Find representatives and senators for a latitude/longitude, zip, or address.

Examples:

client.legislators_locate('94107')
client.legislators_locate(37.775, -122.418)
client.legislators_locate('2169 Mission Street, San Francisco, CA 94110')

Returns:

  • (Hashie::Rash)


31
32
33
# File 'lib/congress/client.rb', line 31

def legislators_locate(*args)
  get('/legislators/locate', extract_location(args))
end

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

Bills scheduled for debate in the future, as announced by party leadership.

Examples:

client.upcoming_bills

Returns:

  • (Hashie::Rash)


105
106
107
# File 'lib/congress/client.rb', line 105

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

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

Roll call votes in Congress, back to 2009. Updated within minutes of votes.

Examples:

client.votes

Returns:

  • (Hashie::Rash)


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

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