Skip to content

An unofficial gem built on top of an unofficial API to the SMTUC

Notifications You must be signed in to change notification settings

fredoliveira/smtuc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMTUC 🚌

An unofficial gem built on top of an unofficial API. For more information about the API used here and its available methods, see sdsantos/smtuc-api. Feel free to add to this and send in your pull requests.

Installing the gem

Either build the gem from the source code (see below), or install it via rubygems

gem install smtuc

Working with the gem source code

To build a new version of the gem:

rake build

You can then install it:

rake install

If you built a new version of the gem and want to push it to rubygems.org use rake release. This will automatically tag the source code according to the new version and create a new release on github.

$ rake release
smtuc 0.0.3 built to pkg/smtuc-0.0.3.gem.
Tagged v0.0.3.
Pushed git commits and tags.
Pushed smtuc 0.0.3 to rubygems.org

See all other available rake tasks`:

rake --tasks

Using the gem

# Require the gem itself
require 'smtuc'

# Get all the known stops
all_stops = SMTUC::Stop.all

# Get information on a specific stop
stop = SMTUC::Stop.find '1402'

# And a stop's next arrivals
stop.arrivals

# Find a stop by location
stop = SMTUC::Stop.by_location(40.25532913208008, -8.433822631835938, 100)

# Get all the known lines
lines = SMTUC::Line.all

# Get information on a specific line
line = SMTUC::Line.find '7T'

Alternatively, if working with the source code, you can open a console with the gem already loaded

bin/console

irb(main):001:0> SMTUC::Stop.all

Want to contribute? Here's a TODO list of pending things

Generic/QOL updates

  • Specs! This has none.

Updates to SMTUC::Line

Updates to SMTUC::Stop

  • Search stops by keyword

Create SMTUC::GTFS

  • Implement an export function that creates a GTFS-ready "feed"

About

An unofficial gem built on top of an unofficial API to the SMTUC

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published