0.0
No commit activity in last 3 years
No release in over 3 years
The Congress V3 API requires an API key which you can get at http://sunlightfoundation.com/api/accounts/register/
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

> 1.12.3
= 0.8.0
~> 2.1.0
~> 0.10.0
~> 10.0
~> 3.0
~> 3.0.0
~> 1.24.0

Runtime

 Project Readme

CongressV3

Coverage Status Build Status

Easily access the CongressV3 API through Ruby

Installation

Add this line to your application's Gemfile:

gem 'congress_v3'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install congress_v3

Usage

First configure with your API KEY from Sunlight Foundation

Once you have your API KEY:

CongressV3::Config.api_key = "MY_API_KEY"

Using the API is simple:

CongressV3::Legislators.all
# => #<CongressV3::Response:0x007fd26a0ef2b0
@count=100,
@page={"count"=>20, "per_page"=>20, "page"=>1},
@results=[ #<CongressV3::Legislator:0x007fa3343989b8 @chamber="house" @in_office=true> ]>

For the Bill API you can even get the text of the bill if it is available

CongressV3::Bill.all(bill_id: "hconres128-114").results.first.text
# => "\n[Congressional Bills 114th Congress]\n[From the U.S. Government Publishing Office]\n[H. Con. Res. 128 Introduced in House..."

One limitation of the Sunlight API is it has a per page limit default to 20. You can take it to the max of 50 easily though CongressV3::Legislators.all(per_page: 50). You can also add query parameters to further refine your criteria CongressV3::Legislators.all(chamber: 'house')

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/CharlesMassry/CongressV3.

License

The gem is available as open source under the terms of the MIT License.