summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/Bus/Prediction.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2023-12-09 13:10:17 +0000
committerdakkar <dakkar@thenautilus.net>2023-12-09 13:10:17 +0000
commit8bd30555a18dcab02dc95ea8b3701cdc7adbabb6 (patch)
tree4a2351d6111c8231fb04db72391ea2da5d60dbf3 /lib/WebService/TFL/Bus/Prediction.pm
parentwe can use the new weather api (diff)
downloadHomePanel-8bd30555a18dcab02dc95ea8b3701cdc7adbabb6.tar.gz
HomePanel-8bd30555a18dcab02dc95ea8b3701cdc7adbabb6.tar.bz2
HomePanel-8bd30555a18dcab02dc95ea8b3701cdc7adbabb6.zip
new bus api
Diffstat (limited to 'lib/WebService/TFL/Bus/Prediction.pm')
-rw-r--r--lib/WebService/TFL/Bus/Prediction.pm26
1 files changed, 26 insertions, 0 deletions
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;