Ruby gem for easy access to EveryPolitician data
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Everypolitician Build Status Gem Version

Interface with EveryPolitician data from your Ruby application.


Add this line to your application's Gemfile:

gem 'everypolitician'

And then execute:

$ bundle

Or install it yourself as:

$ gem install everypolitician


Pass the :slug of the country to the country method, and the :slug of the legislature to the legislature method.


require 'everypolitician'

australia ='Australia')
australia.code # => "AU"
senate = australia.legislature('Senate')
senate.popolo # => #<Everypolitician::Popolo::JSON>

united_kingdom ='UK')
house_of_commons = united_kingdom.legislature('Commons')

american_samoa ='American-Samoa')
house_of_representatives = american_samoa.legislature('House')

united_arab_emirates ='United-Arab-Emirates')
national_council = united_arab_emirates.legislature('Federal-National-Council')

algeria ='Algeria')
national_assembly = algeria.legislature('Majlis')

# Iterate though all known countries do |country|
  puts "#{} has #{country.legislatures.size} legislature(s)"

# Iterate through all known legislatures do |legislature|
  puts "#{} in #{} has #{legislature.person_count} member(s)"

# Fetch Everypolitician::Popolo::LegislativePeriod for the latest term
# Note that this may involve a **substantial download**
puts 'Members of the Assembly:'
assembly ='Albania').lower_house do |person|

By default, the gem connects to EveryPolitician's data on GitHub over HTTPS and returns the most recent data. Specifically it uses the current index file, called countries.json, which itself contains links to specific versions of data files.

If you want to point at a different countries.json, you can override this default behavour by supplying an index_url option to like this: '')

The example above is using a specific commit (indicated by the hash 080cb46). If you want to use a local copy of countries.json you can specify a local file path as the index_url instead of a fully-qualified URL.

For more about countries.json, see this description.

Remember that EveryPolitician data is frequently updated — see this information about using EveryPolitician data.

More information on the EveryPolitician site.


After checking out the repo, run bin/setup to install dependencies. Then, run rake test 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


Bug reports and pull requests are welcome on GitHub at


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