blib/lib/OpenSky/API/Flights.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 30 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # A class representing a flights response from the OpenSky Network API
2  
3 package OpenSky::API::Flights;
4  
5 our $VERSION = '0.004';
6 use Moose;
7 use OpenSky::API::Types qw(InstanceOf);
8 use OpenSky::API::Core::Flight;
9 use OpenSky::API::Utils::Iterator;
10 use experimental qw(signatures);
11  
12 has flights => (
13 is => 'ro',
14 isa => InstanceOf ['OpenSky::API::Utils::Iterator'],
15 handles => [qw(first next reset all count)],
16 );
17  
18 around 'BUILDARGS' => sub ( $orig, $class, $response ) {
19 my @flights = map { OpenSky::API::Core::Flight->new($_) } $response->@*;
20 my $iterator = OpenSky::API::Utils::Iterator->new( rows => \@flights );
21  
22 return $class->$orig( flights => $iterator );
23 };
24  
25 __PACKAGE__->meta->make_immutable;
26  
27 __END__
28  
29 =pod
30  
31 =encoding UTF-8
32  
33 =head1 NAME
34  
35 OpenSky::API::Flights
36  
37 =head1 VERSION
38  
39 version 0.004
40  
41 =head1 METHODS
42  
43 =head2 flights
44  
45 Returns an iterator of L<OpenSky::API::Core::Flight> objects.
46  
47 As a convenience, the following methods are delegated to the iterator:
48  
49 =over 4
50  
51 =item * first
52  
53 =item * next
54  
55 =item * reset
56  
57 =item * all
58  
59 =item * count
60  
61 =back
62  
63 =head1 AUTHOR
64  
65 Curtis "Ovid" Poe <curtis.poe@gmail.com>
66  
67 =head1 COPYRIGHT AND LICENSE
68  
69 This software is Copyright (c) 2023 by Curtis "Ovid" Poe.
70  
71 This is free software, licensed under:
72  
73 The Artistic License 2.0 (GPL Compatible)
74  
75 =cut