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