Project

go_card

0.0
No commit activity in last 3 years
No release in over 3 years
A simple ruby API for the Brisbane Translink Go Card
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.0.0
 Project Readme

GoCard Ruby API

Description

A simple Ruby interface to access the Queensland Transport GoCard website. Modelled on jwpage's PHP API [https://github.com/jwpage/gocard-php-api]

Supports:

  • Login
  • Get Balance
  • Get Activity History
  • Logout

Installation

gem install go_card

Requirements

This API requires the mechanize gem [https://github.com/tenderlove/mechanize], I haven't quite figured out how to bundle this into a gem yet so for now you will have to install it manually:

gem install mechanize

Usage

require 'go_card'

go_card = GoCard.new

# Login and get the account balance
go_card.login('card_number', 'password');
puts go_card.get_balance

# get all the journey actions for the last 30 days
go_card.get_history(30).each { |act|
  puts "#{act[:time]} => #{act[:action]}, #{act[:location]}, #{act[:charge]}"
}

go_card.logoff()