BikeShare
A Ruby gem for interacting with Bay Area Bike Share stations and bike info
- Created by Zack Shapiro.
- Ongoing Bike safety, lanes, and infrastructure efforts by Patrick Traughber and friends.
Installation
This is available as a RubyGem:
gem install bikesharerequire 'bikeshare'Available methods:
response = BikeShare.newReturns the full JSON of stations available and their information
response.last_station_idWill return an integer of the last station in the system
response.station_info(2)Takes a station_id as an integer, returns an hash with that station's info
response.stations("San Francisco")Takes a city name string such as "San Francisco" and returns an array of all the stations in that municipality
response.empty_stationsReturns an array of all stations with 0 availableBikes
response.empty?(2)Takes a station_id as an integer and retuns true or false based on the number of availableBikes
response.full?(2)Takes a station_id as an integer and retuns true or false based on the number of availableBikes and total docks at that station.
response.available_bikes(2)Takes a station_id as an integer and returns the nunber of available bikes
response.total_docks(2)Takes a station_id as an integer and returns the total number of docks at that station
response.percent_available(2)Takes a station_id as an integer and returns the percentage of bikes available, rounded two decimal places
response.offline_stationsReturns an array of stations currently offline
-
For more information, please go to the Bay Area Bike Share website
-
If you would like to contribute, fork this repo, create a new branch with your changes and submit a pull request!
-
If you have any questions, I'm @ZackShapiro on Twitter.
Bikeshare is open source, and made available under the MIT License. Distribute, use as-is, or modify to your liking in personal and commercial projects.