line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::FCM::HTTP::Response; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
97
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
93
|
|
5
|
3
|
|
|
3
|
|
16
|
use JSON qw(decode_json); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
7
|
3
|
|
|
|
|
18
|
new => 0, |
8
|
|
|
|
|
|
|
ro => [qw/http_response content is_success sent_reg_ids/], |
9
|
3
|
|
|
3
|
|
304
|
); |
|
3
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
1564
|
use WWW::FCM::HTTP::Response::ResultSet; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
1255
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
6
|
|
|
6
|
0
|
60
|
my ($class, $http_response) = @_; |
15
|
|
|
|
|
|
|
|
16
|
6
|
|
|
|
|
94
|
my $is_success = $http_response->is_success; |
17
|
6
|
|
|
|
|
110
|
my $content = $http_response->content; |
18
|
6
|
|
|
|
|
94
|
my $req_content = decode_json($http_response->request->content); |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
308
|
my $sent_reg_ids = []; |
21
|
6
|
100
|
|
|
|
31
|
if ($is_success) { |
22
|
5
|
|
|
|
|
203
|
$content = decode_json $content; |
23
|
|
|
|
|
|
|
|
24
|
5
|
100
|
|
|
|
28
|
if (exists $content->{multicast_id}) { |
25
|
4
|
|
|
|
|
12
|
$sent_reg_ids = $req_content->{registration_ids}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
1
|
|
|
|
|
33
|
$content = { error => $content }; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
199
|
bless { |
33
|
|
|
|
|
|
|
is_success => $is_success, |
34
|
|
|
|
|
|
|
content => $content, |
35
|
|
|
|
|
|
|
sent_reg_ids => $sent_reg_ids, |
36
|
|
|
|
|
|
|
http_response => $http_response, |
37
|
|
|
|
|
|
|
}, $class; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub success { |
41
|
6
|
|
|
6
|
0
|
4133
|
shift->content->{success}; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub failure { |
45
|
6
|
|
|
6
|
0
|
4739
|
shift->content->{failure}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub message_id { |
49
|
6
|
|
|
6
|
0
|
4460
|
shift->content->{message_id}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub multicast_id { |
53
|
6
|
|
|
6
|
0
|
4494
|
shift->content->{multicast_id}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub canonical_ids { |
57
|
6
|
|
|
6
|
0
|
4499
|
shift->content->{canonical_ids}; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub error { |
61
|
6
|
|
|
6
|
0
|
18673
|
shift->content->{error}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub has_error { |
65
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
66
|
0
|
0
|
|
|
|
0
|
return 1 unless $self->is_success; |
67
|
0
|
0
|
|
|
|
0
|
$self->error ? 1 : 0; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub results { |
71
|
4
|
|
|
4
|
0
|
3466
|
my $self = shift; |
72
|
4
|
|
50
|
|
|
16
|
my $results = $self->content->{results} || return; |
73
|
4
|
|
|
|
|
45
|
WWW::FCM::HTTP::Response::ResultSet->new($results, $self->sent_reg_ids); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
0
|
|
|
sub DESTROY {}; |
77
|
|
|
|
|
|
|
sub AUTOLOAD { |
78
|
1
|
|
|
1
|
|
1372
|
(my $method = our $AUTOLOAD) =~ s/.*:://; |
79
|
3
|
|
|
3
|
|
25
|
no strict 'refs'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
133
|
|
80
|
1
|
|
|
|
|
14
|
*{$AUTOLOAD} = sub { |
81
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
268
|
|
82
|
6
|
|
|
6
|
|
7131
|
my $self = shift; |
83
|
6
|
|
|
|
|
55
|
$self->{http_response}->$method(@_); |
84
|
1
|
|
|
|
|
20
|
}; |
85
|
1
|
|
|
|
|
13
|
goto &$AUTOLOAD; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |