lib/OpenSky/API/Flights.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 82.7% 24 / 29 CC 1 SCAR 1.5
CC
1
Cov
83%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« lib/OpenSky/API/States.pm ↑ Summary lib/OpenSky/API/Core/Flight.pm »
1 # A class representing a flights response from the OpenSky Network API
2  
3 package OpenSky::API::Flights;
4  
5 5 our $VERSION = '0.004';
6 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use OpenSky::API::Types qw(InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use OpenSky::API::Core::Flight;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use OpenSky::API::Utils::Iterator;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use experimental qw(signatures);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 5 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 ) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 my @flights = map { OpenSky::API::Core::Flight->new($_) } $response->@*;
20 0 my $iterator = OpenSky::API::Utils::Iterator->new( rows => \@flights );
21  
22 0 return $class->$orig( flights => $iterator );
23 5 };
24  
25 5 __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
« lib/OpenSky/API/States.pm ↑ Summary lib/OpenSky/API/Core/Flight.pm »