line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::OpenSky::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: A class representing a response from the OpenSky Network API |
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
4795
|
use WebService::OpenSky::Moose; |
|
8
|
|
|
|
|
31
|
|
|
8
|
|
|
|
|
80
|
|
6
|
8
|
|
|
8
|
|
144875
|
use WebService::OpenSky::Utils::Iterator; |
|
8
|
|
|
|
|
34
|
|
|
8
|
|
|
|
|
429
|
|
7
|
8
|
|
|
|
|
65
|
use WebService::OpenSky::Types qw( |
8
|
|
|
|
|
|
|
ArrayRef |
9
|
|
|
|
|
|
|
Bool |
10
|
|
|
|
|
|
|
HashRef |
11
|
|
|
|
|
|
|
InstanceOf |
12
|
|
|
|
|
|
|
Route |
13
|
8
|
|
|
8
|
|
69
|
); |
|
8
|
|
|
|
|
16
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.4'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
param raw_response => ( |
18
|
|
|
|
|
|
|
isa => ArrayRef | HashRef, |
19
|
|
|
|
|
|
|
default => method() { $self->_empty_response }, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
param route => ( |
23
|
|
|
|
|
|
|
isa => Route, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
param query => ( |
27
|
|
|
|
|
|
|
isa => HashRef, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
field _iterator => ( |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
isa => InstanceOf ['WebService::OpenSky::Utils::Iterator'], |
33
|
|
|
|
|
|
|
writer => '_set_iterator', |
34
|
|
|
|
|
|
|
init_arg => undef, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
field _inflated => ( |
38
|
|
|
|
|
|
|
is => 'rw', |
39
|
|
|
|
|
|
|
isa => Bool, |
40
|
|
|
|
|
|
|
default => 0, |
41
|
|
|
|
|
|
|
init_arg => undef, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
13
|
50
|
|
13
|
0
|
17856
|
method BUILD(@args) { |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
40
|
|
|
13
|
|
|
|
|
21
|
|
45
|
13
|
50
|
|
|
|
105
|
if ( !$self->raw_response ) { |
46
|
0
|
|
|
|
|
0
|
$self->raw_response( $self->_empty_response ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
98
|
50
|
|
98
|
|
186
|
method _inflate() { |
|
98
|
50
|
|
|
|
167
|
|
|
98
|
|
|
|
|
124
|
|
|
98
|
|
|
|
|
119
|
|
51
|
98
|
100
|
|
|
|
234
|
return if $self->_inflated; |
52
|
12
|
|
|
|
|
136
|
my $iterator = WebService::OpenSky::Utils::Iterator->new( rows => $self->_create_response_objects ); |
53
|
12
|
|
|
|
|
22177
|
$self->_set_iterator($iterator); |
54
|
12
|
|
|
|
|
138
|
$self->_inflated(1); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
0
|
|
0
|
method _create_response_iterator() { |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
croak 'This method must be implemented by a subclass'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
0
|
|
0
|
method _empty_response() { |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
62
|
0
|
|
|
|
|
0
|
croak 'This method must be implemented by a subclass'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
50
|
50
|
|
50
|
1
|
5837
|
method iterator() { |
|
50
|
50
|
|
|
|
102
|
|
|
50
|
|
|
|
|
68
|
|
|
50
|
|
|
|
|
72
|
|
66
|
50
|
|
|
|
|
130
|
$self->_inflate; |
67
|
50
|
|
|
|
|
351
|
return $self->_iterator; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
36
|
50
|
|
36
|
1
|
207301
|
method next() { ## no critic (Subroutines::ProhibitBuiltinHomonyms) |
|
36
|
50
|
|
|
|
100
|
|
|
36
|
|
|
|
|
61
|
|
|
36
|
|
|
|
|
44
|
|
71
|
36
|
|
|
|
|
112
|
$self->_inflate; |
72
|
36
|
|
|
|
|
248
|
return $self->iterator->next; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
0
|
1
|
0
|
method first() { |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
76
|
0
|
|
|
|
|
0
|
$self->_inflate; |
77
|
0
|
|
|
|
|
0
|
return $self->iterator->first; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
0
|
1
|
0
|
method reset() { ## no critic (Subroutines::ProhibitBuiltinHomonyms) |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
81
|
0
|
|
|
|
|
0
|
$self->_inflate; |
82
|
0
|
|
|
|
|
0
|
return $self->iterator->reset; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
0
|
1
|
0
|
method all() { |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
86
|
0
|
|
|
|
|
0
|
$self->_inflate; |
87
|
0
|
|
|
|
|
0
|
return $self->iterator->all; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
12
|
50
|
|
12
|
1
|
3474
|
method count() { |
|
12
|
50
|
|
|
|
44
|
|
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
16
|
|
91
|
12
|
|
|
|
|
49
|
$self->_inflate; |
92
|
12
|
|
|
|
|
146
|
return $self->iterator->count; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding UTF-8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
WebService::OpenSky::Response - A class representing a response from the OpenSky Network API |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 VERSION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
version 0.4 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 DESCRIPTION |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This class represents iterator from the OpenSky Network API. By default, it does |
112
|
|
|
|
|
|
|
not instantiate individual response objects until you first ask for them. This is for performance reasons. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 METHODS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 raw_response |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The raw response from the OpenSky Network API. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 route |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The route used to retrieve this response. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 query |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The query used to retrieve this response. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 iterator |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Returns an iterator of results. See L<WebService::OpenSky> to understand the |
131
|
|
|
|
|
|
|
actual response class returned for a given method and which underlying module |
132
|
|
|
|
|
|
|
represents the results. (Typically this would be |
133
|
|
|
|
|
|
|
L<WebService::OpenSky::Core::Flight> or |
134
|
|
|
|
|
|
|
L<WebService::OpenSky::Core::StateVector>.) |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
As a convenience, the following methods are delegated to the iterator: |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over 4 |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * first |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * next |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * reset |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * all |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * count |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 AUTHOR |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Curtis "Ovid" Poe <curtis.poe@gmail.com> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This software is Copyright (c) 2023 by Curtis "Ovid" Poe. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is free software, licensed under: |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |