Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Ruby API for the Barclays Cycle Hire scheme in London
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Cycle Hire

Cycle Hire is a Ruby API for the Barclays Cycle Hire scheme in London. It primarily works by scraping the TfL website.

It provides access to the following data:

  • User journey history
  • Docking station status


Ruby 1.9 and Bundler. (It'll probably work on Ruby 1.8 but is untested)

Bundler installs:

  • Nokogiri
  • HTTParty


gem install cycle_hire

Or, add this to your Gemfile:

gem 'cycle_hire'

Usage (binaries)

Fetch journey history

./bin/cycle_hire_history <email> <password>

Where the access credentials are your login to the cycle hire section of the TfL website. Outputs the data in YAML format.

Fetch docking station status

./bin/cycle_hire_status <station>

Where station is a regex of stations you want to match. Outputs the data in YAML format.

Usage (in your code)

Fetch journey history

  session = CycleHire.authenticate email, password
  # raises CycleHire::Session::AuthenticationError if
  # the email or password and incorrect

  journeys = session.journeys
  # array of the users journeys

Fetch docking station status

  stations = CycleHire.stations
  # array of stations, see CycleHire::Station
  # for more details


  • Tests
  • Access to more user account data (e.g. balance, membership expiry)


  • Fork the project.
  • Make your feature addition or bug fix.
  • Send me a pull request. Bonus points for topic branches.
  • Add tests for what you are building, and make sure you don't break any existing tests.


Creative Commons License
cycle-hire by Luca Spiller is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at
Permissions beyond the scope of this license may be available at

Something went wrong with that request. Please try again.