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.
Either build the gem from the source code (see below), or install it via rubygems
gem install smtuc
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
# 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
- Specs! This has none.
- Implement a function that retuns a specific line's schedule (See reference by sdsantos)
- Search stops by keyword
- Implement an export function that creates a GTFS-ready "feed"