Project

spbus

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Easily retrieve information about São Paulo bus routes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
>= 0
>= 0

Runtime

 Project Readme

SpBus

A small Ruby client for SPTrans API which allows you to retrieve data about São Paulo city buses, lines, stops and real-time (GPS) information.

Code Climate Gem Version Build Status

Installation

Add this line to your Gemfile:

gem 'spbus'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spbus

Usage

First of all, get your API token at SPTrans developers page. Then you can play with the client:

client = SpBus::Client.new("your api token goes here")

Authentication

Before do any request, client must be authenticated. So, let's authenticate:

client.authenticate #=> true

Search

client.search("largo sao francisco") #=> [#<SpBus::Line ...>, #<SpBus::Line ...>, ...]

Line stops

client.stops(line.id) #=> [#<SpBus::Stop ...>, #<SpBus::Stop ...>, ...]

Real-time (GPS)

client.buses(line.id) #=> [#<SpBus::Bus ...>, #<SpBus::Bus ...>, ...]

Contributing

  1. Fork it (http://github.com/lenon/spbus/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

To-do

  • Improve documentation.
  • Support more endpoints (like estimated time of arrival and bus lanes).