From 8bd30555a18dcab02dc95ea8b3701cdc7adbabb6 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 9 Dec 2023 13:10:17 +0000 Subject: new bus api --- lib/WebService/TFL/Bus/Prediction.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lib/WebService/TFL/Bus/Prediction.pm (limited to 'lib/WebService/TFL/Bus/Prediction.pm') diff --git a/lib/WebService/TFL/Bus/Prediction.pm b/lib/WebService/TFL/Bus/Prediction.pm new file mode 100644 index 0000000..670baf7 --- /dev/null +++ b/lib/WebService/TFL/Bus/Prediction.pm @@ -0,0 +1,26 @@ +package WebService::TFL::Bus::Prediction; +use Moo; +use Types::Standard -all; +use Types::DateTime -all; +use namespace::clean; + +has [qw(stationName lineName towards)] => ( + is => 'ro', + isa => Str, + required => 1, +); + +has 'expectedArrival' => ( + is => 'ro', + isa => DateTimeUTC->plus_coercions( Format['ISO8601'] ), + required => 1, + coerce => 1, +); + +sub new_from_response { + my ($class,$response_data) = @_; + + return $class->new($response_data); +} + +1; -- cgit v1.2.3