Giter Club home page Giter Club logo

dvbrb's Introduction

DVB

Gem Travis GitHub issues Gemnasium

This is an unofficial gem giving you a few options to query Dresden's public transport system for current bus- and tramstop data.

Want something like this for another language, look no further 🙂

Installation

Add this line to your application's Gemfile:

gem 'dvb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dvb

Quick Start

# Don't forget to require dvb
require 'dvb'

# Calling the following will return a list of DVB::Departure objects
# encapsulating information about upcoming departures at the given stop. 
# I've also gone ahead and filtered out departures that do not have "3" 
# as their line identifier.

deps = DVB.monitor('albertplatz').select { |d| d.line == '3' }
puts deps
# 3 Coschütz @ 2016-08-29 17:57:58 +0200
# 3 Wilder Mann @ 2016-08-29 18:03:58 +0200
# 3 Coschütz @ 2016-08-29 18:07:58 +0200
# ...

# The second optional parameter sets a time offset into the future, 
# default is 0. The third optional parameter limits the amount of results, 
# default is as many as possible.

deps = DVB.monitor('albertplatz', 10, 2)
puts deps
# 8 Südvorstadt @ 2016-08-29 18:30:00 +0200
# 6 Wölfnitz @ 2016-08-29 18:31:00 +0200
# You can also use dvb to find stops using two different methods. Either
# look them up by name or via coordinates. DVB::Stop objects include an id, 
# latitude, longitude, name, region and tarif_zones amongst other info.

# The second optional param is the region. It defaults to Dresden.
stops = DVB.find('helmh', 'Dresden')
puts stops
# Helmholtzstraße, Dresden

# The third optional param here is the searchradius in meters. 
# It defaults to 500.
stops = DVB.find_near(51.063313, 13.746748, 500)
puts stops
# Bautzner Straße / Rothenburger Straße, Dresden
# Albertplatz, Dresden
# Bahnhof Neustadt, Dresden

Contributing

Please don't hesitate opening an issue should any questions/bugs/whatever arise.

Pull requests are of course just as welcome. If you're interested in adding additional functionality, why not open an issue beforehand so we can discuss how to integrate it best 😊

License

The gem is available as open source under the terms of the MIT License.

Why?

At this point I consider writing wrappers for the DVB/VVO APIs as somewhat of an extensive hello-world exercise for myself. I'm trying to get back into Ruby and realized I've never published a gem, so here goes nothing 😄

dvbrb's People

Contributors

kiliankoe avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

dvbrb's Issues

Migrate to WebAPI

Since EFA is going to be shut down at some point in the rather near future, it seems like a good idea to use the chance to migrate to use the WebAPI instead and also replace the widgets endpoint while at it.

Big upside is a whole bunch of new data being supplied by the WebAPI.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.