London Bike Hire CLI
A simple command line interface to London's Bike Hire API.
Description
This gem provides a command line interface to find information about London's Bike Hire stations, it allows you to find stations by name or their ID or a location and retrieve information about the status of a station.
I got fed up digging through the official map to see which bike stations were free - everyone knows the command line is way more efficient.
Here's the spec for London Bike Hire CLI:
- Find all stations
- Find by ID
- Find nearest station
- Find by name
- Display status of stations
Getting started
Using london-bike-hire-cli could not be simpler - just install the london-bike-hire-cli gem.
$ gem install london-bike-hire-cli
Usage
You can run london-bike-hire-cli from the command line with just the lbh
command.
Command line help
For a list of arguments just use the -h
switch.
$ lbh -h
List all bike stations
List all however-many-hundred bike stations there are. With pagination.
$ lbh all
Find the nearest bike station
Find a the nearest bike station to the specified type below. This will return five stations.
Available types:
-
search
- Most search terms; such as placename, postcode -
id
- An ID of another bike station
$ lbh near --{type} {search_value}
# Near by search term
$ lbh near --search N19AE
$ lbh near --search 'waterloo station'
# Near another bike station id
$ lbh near --id 123
Note: Don't forget to wrap search term in quotes if it contains spaces.
Find a bike station by id
Find a Bike station by it's Tfl station ID. This will return one station.
$ lbh find --id {id}
$ lbh find --id 439
Find all bike stations by name
Search all bike stations' name attribute for the search value. This will return zero or more results.
$ lbh where --{attribute} {search_value}
$ lbh where --name kings
Results
$ lbh find --id 439
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
----- Bike station
Id: 439
Name: Killick Street, Kings Cross
Lat: 51.5338
Long: -0.118677
Temporary: false
Bikes: 13
Docks_free: 9
Docks_total: 22
Link to map: https://www.google.co.uk/maps/preview/@51.5338,-0.118677,17z
Updated at: 2015-03-31 20:46:01
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Contributing
- Fork it ( https://github.com/rob-murray/london-bike-hire-cli/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Development
Install dependancies
$ bundle install --no-deployment
Run test script as entry point to application
$ ruby test.rb find --id 439
License
This project is available for use under the MIT software license. See LICENSE
The above image is copyright 2015 Getty Images - Getty Images for Santander.