0.0
No commit activity in last 3 years
No release in over 3 years
Simple gem for interfacing with openparliament.ca's API
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

Open Parliament gem

A simple gem to interface with the api at https://openparliament.ca/api/

##Features Currently supports basic GETs of 5 endpoints: Bills, Committees, Debates, Politicians, and Votes. These endpoints return lists of OpenParliament objects (which are currently just OpenStructs).

##Usage

gem install open_parliament

require 'open_parliament'

# Get lists of Bills, Committees, Debates, Politicians, and Votes
OpenParliament.bills => [OpenParliament::Bill...]
OpenParliament.committees => [OpenParliament::Committee..]
OpenParliament.debates => [OpenParliament::Debate...]
OpenParliament.politicians => [OpenParliament::Politican...]
OpenParliament.votes => [OpenParliament::Vote...]

# Get properties from these objects as you would any OpenStruct
vote = OpenParliament.votes.first
vote.result => "Passed"
vote.description["en"] => "That the Bill be now read a third time and do pass."

###Filters Filters listed in the https://openparliament.ca/api/ resource pages are supported.

OpenParliament.bills(private_member_bill: true)
 => [#<OpenParliament::Bill ...]
 
OpenParliament.politicians(family_name: 'Trudeau')
 => [#<OpenParliament::Politician url="/politicians/justin-trudeau/", name="Justin Trudeau">] 

###Pagination

 # Pagination with limit/offset. Defaults to limit:20, offset:0
first_bill = OpenParliament.bills(limit: 1)
second_bill = OpenParliament.bills(limit: 1, offset: 1)