A small Ruby client for SPTrans API which allows you retrieve information about São Paulo city buses, lines, stops and real time schedules.
Add this line to your Gemfile:
And then execute:
Or install it yourself as:
$ gem install spbus
First of all, get your API token from SPTrans. Then you can play with the client:
client = SpBus::Client.new("your api token")
All API requests are authenticated. So, let's authenticate:
client.authenticate #=> true
client.search("largo sao francisco") #=> [#<SpBus::Line ...>, #<SpBus::Line ...>, ...]
client.stops(line.id) #=> [#<SpBus::Stop ...>, #<SpBus::Stop ...>, ...]
client.buses(line.id) #=> [#<SpBus::Bus ...>, #<SpBus::Bus ...>, ...]
- Fork it (http://github.com/lenon/spbus/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 new Pull Request
- Improve documentation.
- Support more endpoints (like estimated time of arrival and bus lanes).