Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

lenon/spbus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Ruby client for the SPTrans (São Paulo Transporte) API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages