Group
Extension

Matches 5

Travel-Status-MOTIS ( D/DE/DERF/Travel-Status-MOTIS-0.03.tar.gz, DERF, 2025; MetaCPAN )
Travel-Status-MOTIS/lib/Travel/Status/MOTIS.pm ( view source; MetaCPAN )
 Carp qw(confess);
use DateTime;
use DateTime::Format::ISO8601;
use Encode qw(decode encode);
use JSON;

use LWP::UserAgent;

use URI;

use Travel::Status::MOTIS::Services;
use Travel::Status::MOTIS::
p_id / trip_id / stops_by_coordinate / stops_by_query must be specified'
		);
	}

	my $json = $self->{json} = JSON->new->utf8;

	$request_url
	  = $request_url->abs( $motis_instance->{$service}{endpoi
nc} ) {
		$self->{request_url} = $request_url;
		return $self;
	}

	if ( $conf{json} ) {
		$self->{raw_json} = $conf{json};
	}
	else {
		if ( $self->{developer_mode} ) {
			say "requesting $request_ur
Travel-Status-MOTIS ( D/DE/DERF/Travel-Status-MOTIS-0.03.tar.gz, DERF, 2025; MetaCPAN )
Travel-Status-MOTIS/lib/Travel/Status/MOTIS/Stop.pm ( view source; MetaCPAN )
_match {
	my ( $obj, %opt ) = @_;

	my $json = $opt{json};

	my $ref = {
		id   => $json->{id},
		name => $json->{name},
		lat  => $json->{lat},
		lon  => $json->{lon},
	};

	bless( $ref, $obj );

	re

	my $json = $opt{json};

	my $ref = {
		id   => $json->{stopId},
		name => $json->{name},
		lat  => $json->{lat},
		lon  => $json->{lon},
	};

	bless( $ref, $obj );

	return $ref;
}

sub TO_JSON {
	m
Travel-Status-MOTIS ( D/DE/DERF/Travel-Status-MOTIS-0.03.tar.gz, DERF, 2025; MetaCPAN )
Travel-Status-MOTIS/lib/Travel/Status/MOTIS/TripAtStopover.pm ( view source; MetaCPAN )
 = @_;

	my $json      = $opt{json};
	my $time_zone = $opt{time_zone};

	my $ref = {
		id               => $json->{tripId},
		mode             => $json->{mode},
		agency           => $json->{agencyNam
       => $json->{routeShortName},
		route_color      => $json->{routeColor},
		route_text_color => $json->{routeTextColor},
		headsign         => $json->{headsign},

		is_cancelled => $json->{cancell
$json->{realTime},

		stopover => Travel::Status::MOTIS::Stopover->new(
			json => $json->{place},

			# NOTE: $json->{place}->{cancelled} isn't set, we just override this here.
			cancelled => $json-
Travel-Status-MOTIS ( D/DE/DERF/Travel-Status-MOTIS-0.03.tar.gz, DERF, 2025; MetaCPAN )
Travel-Status-MOTIS/lib/Travel/Status/MOTIS/Trip.pm ( view source; MetaCPAN )
 @_;

	my $json = $opt{json}{legs}[0];
	my $time_zone = $opt{time_zone};

	my $ref = {
		id               => $json->{tripId},
		mode             => $json->{mode},
		agency           => $json->{agencyN
       => $json->{routeShortName},
		route_color      => $json->{routeColor},
		route_text_color => $json->{routeTextColor},
		headsign         => $json->{headsign},

		is_cancelled => $json->{cancell
ed},
		is_realtime  => $json->{realTime},

		raw_stopovers =>
		  [ $json->{from}, @{ $json->{intermediateStops} }, $json->{to} ],
		raw_polyline => $json->{legGeometry},

		time_zone    => $time_zone
Travel-Status-MOTIS ( D/DE/DERF/Travel-Status-MOTIS-0.03.tar.gz, DERF, 2025; MetaCPAN )
Travel-Status-MOTIS/lib/Travel/Status/MOTIS/Stopover.pm ( view source; MetaCPAN )
rack
	  scheduled_track
	  realtime_track
	)
);

sub new {
	my ( $obj, %opt ) = @_;

	my $json      = $opt{json};
	my $realtime  = $opt{realtime} // 0;
	my $cancelled = $opt{cancelled};
	my $time_zone
::Status::MOTIS::Stop->from_stopover( json => $json ),

		is_realtime  => $realtime,
		is_cancelled => $json->{cancelled} // $cancelled,
	};

	if ( $json->{scheduledArrival} ) {
		$ref->{scheduled_arr
 = DateTime::Format::ISO8601->parse_datetime(
			$json->{scheduledArrival} );
		$ref->{scheduled_arrival}->set_time_zone( $time_zone );
	}

	if ( $json->{arrival} and $realtime ) {
		$ref->{realtime_a

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.