Project

bart

0.01
No commit activity in last 3 years
No release in over 3 years
Access the Bay Area Rapid Transit API in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 5.0
>= 0

Runtime

~> 1.6
 Project Readme

A Ruby wrapper around the BART API. http://api.bart.gov/

Current gem version

Usage

Create a new station object

require 'bart/station'

station = Bart::Station.new(abbr: 'ssan')
station.name
# => "South San Francisco"

See when then next trains are supposed to arrive

station.load_departures
station.departures.map do |d|
  [d.destination.name, d.estimates.map { |e| e.minutes }]
end
# => [["Pittsburg/Bay Point", [5, 25, 50]], ["Millbrae", [5, 25, 46]]]

Output a list of upcoming departures:

require 'bart'
puts Bart(abbr: :powl).departures
# San Francisco Int'l Airport 2, 22
# Pittsburg/Bay Point 4, 19

NOTE: This is still beta software. All public APIs are subject to change

Testing

To run the tests run the test Rake task:

$ bundle install
$ bundle exec rake test