Project

cycle_hire

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A Ruby API for the Barclays Cycle Hire scheme in London
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0.8
>= 1.5
 Project Readme

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

Requirements

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

Bundler installs:

  • Nokogiri
  • HTTParty

Installation

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

Todo

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

Contributing

  • 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.

License

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 github.com.
Permissions beyond the scope of this license may be available at https://github.com/lucaspiller/cycle-hire.