Skip to content

A simple Ruby interface to access the Queensland Transport GoCard website.

Notifications You must be signed in to change notification settings

jamiecook/gocard-ruby-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

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()

About

A simple Ruby interface to access the Queensland Transport GoCard website.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages