Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jish/bart
A Ruby wrapper around the BART API.
https://github.com/jish/bart
Last synced: about 2 months ago
JSON representation
A Ruby wrapper around the BART API.
- Host: GitHub
- URL: https://github.com/jish/bart
- Owner: jish
- Created: 2010-11-13T07:07:13.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2015-07-11T18:32:06.000Z (over 9 years ago)
- Last Synced: 2024-10-08T15:51:15.845Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 196 KB
- Stars: 9
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A Ruby wrapper around the BART API. [http://api.bart.gov/](http://api.bart.gov/)
[![Current gem version](https://badge.fury.io/rb/bart.svg)](https://rubygems.org/gems/bart)
## Usage
Create a new station object
```ruby
require 'bart/station'station = Bart::Station.new(abbr: 'ssan')
station.name
# => "South San Francisco"
```See when then next trains are supposed to arrive
```ruby
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:
```ruby
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