From b19803057abe396da21e7bcd0c072eeb3537f514 Mon Sep 17 00:00:00 2001 From: Moritz Schlarb Date: Thu, 12 Jan 2017 23:28:35 +0100 Subject: Add service definition for MVG Mainz --- lib/Travel/Status/DE/URA.pm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/Travel/Status') diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index 474d636..c08ec49 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -347,6 +347,12 @@ sub get_services { name => 'Aachener Straßenbahn und Energieversorgungs AG', shortname => 'ASEAG', }, + { + ura_base => 'http://ura.itcs.mvg-mainz.de/interfaces/ura', + ura_version => 1, + name => 'MVG Mainz', + shortname => 'mvg-mainz', + }, { ura_base => 'http://countdown.api.tfl.gov.uk/interfaces/ura', ura_version => 1, -- cgit v1.2.3 From 2173c7e7b2ab13271796ac840cab4c44318a5790 Mon Sep 17 00:00:00 2001 From: Moritz Schlarb Date: Thu, 12 Jan 2017 23:37:27 +0100 Subject: Also add module Travel::Status::DE::MvgMainz Change shortname of service to MvgMainz to be consistent with the module name. --- Changelog | 1 + lib/Travel/Status/DE/MvgMainz.pm | 96 ++++++++++++++++++++++++++++++++++++++++ lib/Travel/Status/DE/URA.pm | 2 +- 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 lib/Travel/Status/DE/MvgMainz.pm (limited to 'lib/Travel/Status') diff --git a/Changelog b/Changelog index c997668..2a9fb2c 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ Travel::Status::DE::URA UNRELEASED * Add support for departures in Mainz supplied by the local URA service + * New module: Travel::Status::DE::MvgMainz Travel::Status::DE::URA 2.00 - Wed Sep 07 2016 diff --git a/lib/Travel/Status/DE/MvgMainz.pm b/lib/Travel/Status/DE/MvgMainz.pm new file mode 100644 index 0000000..4663411 --- /dev/null +++ b/lib/Travel/Status/DE/MvgMainz.pm @@ -0,0 +1,96 @@ +package Travel::Status::DE::MvgMainz; + +use strict; +use warnings; +use 5.010; + +no if $] >= 5.018, warnings => 'experimental::smartmatch'; + +our $VERSION = '2.00'; + +use parent 'Travel::Status::DE::URA'; + +sub new { + my ( $class, %opt ) = @_; + + $opt{ura_base} = 'http://ura.itcs.mvg-mainz.de/interfaces/ura'; + $opt{ura_version} = '1'; + + return $class->SUPER::new(%opt); +} + +1; + +__END__ + +=head1 NAME + +Travel::Status::DE::MvgMainz - unofficial MVG departure monitor. + +=head1 SYNOPSIS + + use Travel::Status::DE::MvgMainz; + + my $status = Travel::Status::DE::MvgMainz->new( + stop => 'Hauptbahnhof West' + ); + + for my $d ($status->results) { + printf( + "%s %-5s %25s (in %d min)\n", + $d->time, $d->line, $d->destination, $d->countdown + ); + } + +=head1 VERSION + +version 2.00 + +=head1 DESCRIPTION + +Travel::Status::DE::MvgMainz is an unofficial interface to the MVG Mainz realtime +departure monitor. + +=head1 METHODS + +=over + +=item my $status = Travel::Status::DE::MvgMainz->new(I<%opt>) + +Requests the departures as specified by I and returns a new +Travel::Status::DE::MvgMainz object. + +Calls Travel::Status::DE::URA->new with the appropriate B and +B parameters. All I are passed on. + +See Travel::Status::DE::URA(3pm) for the other methods. + +=back + +=head1 DIAGNOSTICS + +None. + +=head1 DEPENDENCIES + +=over + +=item * Travel::Status::DE::URA(3pm) + +=back + +=head1 BUGS AND LIMITATIONS + +Many. + +=head1 SEE ALSO + +MvgMainz-m(1), Travel::Status::DE::URA(3pm). + +=head1 AUTHOR + +Copyright (C) 2016 by Moritz Schlarb Emoschlar@metalabs.deE + +=head1 LICENSE + +This module is licensed under the same terms as Perl itself. diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index c08ec49..f290e53 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -351,7 +351,7 @@ sub get_services { ura_base => 'http://ura.itcs.mvg-mainz.de/interfaces/ura', ura_version => 1, name => 'MVG Mainz', - shortname => 'mvg-mainz', + shortname => 'MvgMainz', }, { ura_base => 'http://countdown.api.tfl.gov.uk/interfaces/ura', -- cgit v1.2.3