line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Azure::NotificationHubs::Response; |
2
|
7
|
|
|
7
|
|
33
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
137
|
|
3
|
7
|
|
|
7
|
|
26
|
use warnings; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
112
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
3120
|
use JSON; |
|
7
|
|
|
|
|
49221
|
|
|
7
|
|
|
|
|
25
|
|
6
|
7
|
|
|
7
|
|
686
|
use Carp; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
301
|
|
7
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
8
|
7
|
|
|
|
|
33
|
ro => [qw[status reason headers content success]], |
9
|
|
|
|
|
|
|
new => 0 |
10
|
7
|
|
|
7
|
|
637
|
); |
|
7
|
|
|
|
|
1347
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
3
|
|
|
3
|
0
|
15
|
my ($class, $status, $reason, $headers, $content, $success) = @_; |
14
|
3
|
|
50
|
|
|
38
|
bless { |
15
|
|
|
|
|
|
|
status => $status, |
16
|
|
|
|
|
|
|
reason => $reason, |
17
|
|
|
|
|
|
|
headers => $headers || {}, |
18
|
|
|
|
|
|
|
content => $content, |
19
|
|
|
|
|
|
|
success => $success, |
20
|
|
|
|
|
|
|
}, $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub as_hashref { |
24
|
2
|
|
|
2
|
1
|
1141
|
my $self = shift; |
25
|
2
|
50
|
|
|
|
11
|
return if !$self->success; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
23
|
my $type = $self->headers->{'content-type'}; |
28
|
|
|
|
|
|
|
|
29
|
2
|
100
|
66
|
|
|
49
|
if ($type && $type =~ /\Aapplication\/json/) { |
30
|
1
|
|
|
|
|
80
|
return JSON->new->utf8(1)->decode($self->{content}); |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
3
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=encoding utf-8 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Net::Azure::NotificationHubs::Response - A Response Class for Net::Azure::NotificationHubs |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
use Net::Azure::NotificationHubs::Request; |
46
|
|
|
|
|
|
|
use HTTP::Tiny; |
47
|
|
|
|
|
|
|
my $req = Net::Azure::NotificationHubs::Request->new(GET => 'http://...'); |
48
|
|
|
|
|
|
|
$req->agent(HTTP::Tiny->new); |
49
|
|
|
|
|
|
|
my $res = $req->do; |
50
|
|
|
|
|
|
|
my $json_data = $res->as_hashref; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 DESCRIPTION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Net::Azure::NotificationHubs::Response is a response class for Net::Azure::NotificationHubs. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
It inherits HTTP::Response. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 as_hashref |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $json_data = $res->as_hashref; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Return a content data as hashref when content type is 'application/json'. Otherwise, undef is returned. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 LICENSE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Copyright (C) ytnobody. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
71
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
ytnobody Eytnobody@gmail.comE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |