0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
This will download and parse the lastest list of members and their contact details for the alleged parliament of the State of Victoria and the alleged federal parliament for Australia so far.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Parliamentarian

Description

Download and parse the current list of members of parliament, and their contact details, from the parliaments which publish one as a CSV.

Two are covered so far: the federal parliament of Australia, and the parliament of the State of Victoria. Each chamber is a method, and each row comes back as an object whose attributes are the column headings underscored, so a CSV which gains a column gains an attribute without anything here being changed.

Installation

0. Have a recent version of Ruby installed

1. Via RubyGems

$ gem install parliamentarian

Or in a Gemfile:

gem 'parliamentarian'

Usage

Australia, federally

require 'parliamentarian'

Parliamentarian::Australia::Federal.senators
# => [#<Parliamentarian::Australia::Federal>, ...], the Senate

Parliamentarian::Australia::Federal.members
# => [#<Parliamentarian::Australia::Federal>, ...], the House of Representatives

Parliamentarian::Australia::Federal.all
# => both chambers together

Victoria

Parliamentarian::Australia::Victoria.legislative_councillors
# => [#<Parliamentarian::Australia::Victoria>, ...], the upper house

Parliamentarian::Australia::Victoria.legislative_assemblymembers
# => [#<Parliamentarian::Australia::Victoria>, ...], the lower house

Parliamentarian::Australia::Victoria.all
# => both houses together

A member

The attributes are the CSV's own column headings, underscored:

member = Parliamentarian::Australia::Victoria.legislative_councillors.first

member.last_name        # => "Smith"
member.preferred_name   # => "Jane"
member.electorate       # => "Southern Metropolitan"
member.party            # => "Australian Labor Party"
member.eo_postcode      # => "3000", taken from the electorate office address

first_name, firstname, lastname and surname are aliases, the two parliaments not agreeing on which of them to publish.

Reading from a file rather than the web

Each method takes a path, which is what the tests use and what a cached copy wants:

Parliamentarian::Australia::Victoria.legislative_councillors('councilmembers.csv')
Parliamentarian::Australia::Victoria.all('councilmembers.csv', 'assemblymembers.csv')

A path is read from disk and anything with an http or https scheme is fetched, so the same method serves both.

Contributing

  1. Fork it: https://github.com/thoran/parliamentarian/fork
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Create a new pull request

License

MIT