BikeShare: a Ruby gem for Bay Area Bike Share
San Francisco is a fantastic city that suffers from some infrastructure problems. Most notably, biking infrastructure is pretty sparse. Of all of the ways to get around the city, biking is probably the best (and healthiest) option. That said, we need to make our city so much safer and more accessible for bikers.
Recently, Bay Area Bike Share went live which will help introduce more biking into the city and the South Bay. Options for their web and mobile apps aren’t too good right now and I wanted to help.
bikeshare is a Ruby gem that makes working with Bay Area Bike Share’s station and bike information pretty easy.
Start by including
bikeshare in your Gemfile or with a
require statement at the top of your Ruby script.
After, you can instantiate a new
BikeShare class which will give you the latest data from every bike share station in the Bay Area.
You have access to methods like:
.station_infowhich takes a station id integer (between 2 and 77) and returns all data related to that particular station.
.stationswhich takes a string like “San Francisco” or “Palo Alto” and returns an array of all of the stations in that area.
.empty?will tell you whether a particular station is empty by its id.
.available_bikeswill tell you how many bikes are available to take out at a particular station.
.offline_stationswill tell you which stations, if any, are not currently in operation.
bikeshare is open source. Feel free to fork it, add, remove, remix, or improve it. If you decide to build an app using the gem, please let me know, I’d love to see it!
Finally, my good friend Patrick Traughber is leading an inspiring effort to help bring safer infrastructure for bikers in the city. That means fighting for better-designed streets and many more bike lanes in high-traffic areas.
He has been studying cities all over the world and noting who has the best systems in place for bikers (Copenhagen and New York City) and has been working with bikers, business owners, community members, and politicians in the city to bring awareness.
If you would like to help in his effort, please email him.