line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Hexonet::Connector::ResponseTemplate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
705
|
use 5.026_000; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
6
|
1
|
|
|
1
|
|
660
|
use WebService::Hexonet::Connector::ResponseParser; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
7
|
1
|
|
|
1
|
|
697
|
use WebService::Hexonet::Connector::ResponseTemplateManager; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
50
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use version 0.9917; our $VERSION = version->declare('v2.9.2'); |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $rtm = WebService::Hexonet::Connector::ResponseTemplateManager->getInstance(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
109
|
|
|
109
|
1
|
5897
|
my ( $class, $raw ) = @_; |
16
|
109
|
|
|
|
|
228
|
my $self = {}; |
17
|
109
|
100
|
100
|
|
|
584
|
if ( !defined $raw || length $raw == 0 ) { |
18
|
11
|
|
|
|
|
21
|
$raw = "[RESPONSE]\r\nCODE=423\r\nDESCRIPTION=Empty API response. Probably unreachable API end point {CONNECTION_URL}\r\nEOF\r\n"; |
19
|
|
|
|
|
|
|
} |
20
|
109
|
|
|
|
|
291
|
$self->{raw} = $raw; |
21
|
109
|
|
|
|
|
344
|
$self->{hash} = WebService::Hexonet::Connector::ResponseParser::parse($raw); |
22
|
109
|
100
|
66
|
|
|
552
|
if ( !defined $self->{hash}->{'DESCRIPTION'} || !defined $self->{hash}->{'CODE'} ) { |
23
|
1
|
|
|
|
|
12
|
$self->{raw} = $rtm->getTemplate('invalid')->getPlain(); |
24
|
1
|
|
|
|
|
5
|
$self->{hash} = WebService::Hexonet::Connector::ResponseParser::parse( $self->{raw} ); |
25
|
|
|
|
|
|
|
} |
26
|
109
|
|
|
|
|
481
|
return bless $self, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub getCode { |
31
|
3
|
|
|
3
|
1
|
13
|
my $self = shift; |
32
|
3
|
|
|
|
|
18
|
return ( $self->{hash}->{CODE} + 0 ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub getDescription { |
37
|
7
|
|
|
7
|
1
|
26
|
my $self = shift; |
38
|
7
|
|
|
|
|
46
|
return $self->{hash}->{DESCRIPTION}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub getPlain { |
43
|
32
|
|
|
32
|
1
|
145
|
my $self = shift; |
44
|
32
|
|
|
|
|
170
|
return $self->{raw}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub getQueuetime { |
49
|
2
|
|
|
2
|
1
|
10
|
my $self = shift; |
50
|
2
|
100
|
|
|
|
7
|
if ( defined $self->{hash}->{QUEUETIME} ) { |
51
|
1
|
|
|
|
|
8
|
return ( $self->{hash}->{QUEUETIME} + 0.00 ); |
52
|
|
|
|
|
|
|
} |
53
|
1
|
|
|
|
|
4
|
return 0.00; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub getHash { |
58
|
61
|
|
|
61
|
1
|
151
|
my $self = shift; |
59
|
61
|
|
|
|
|
186
|
return $self->{hash}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub getRuntime { |
64
|
2
|
|
|
2
|
1
|
11
|
my $self = shift; |
65
|
2
|
100
|
|
|
|
7
|
if ( defined $self->{hash}->{RUNTIME} ) { |
66
|
1
|
|
|
|
|
8
|
return ( $self->{hash}->{RUNTIME} + 0.00 ); |
67
|
|
|
|
|
|
|
} |
68
|
1
|
|
|
|
|
6
|
return 0.00; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub isError { |
73
|
2
|
|
|
2
|
1
|
1846
|
my $self = shift; |
74
|
2
|
|
|
|
|
11
|
my $first = substr $self->{hash}->{CODE}, 0, 1; |
75
|
2
|
|
|
|
|
16
|
return ( $first eq '5' ); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub isSuccess { |
80
|
18
|
|
|
18
|
1
|
8380
|
my $self = shift; |
81
|
18
|
|
|
|
|
78
|
my $first = substr $self->{hash}->{CODE}, 0, 1; |
82
|
18
|
|
|
|
|
107
|
return ( $first eq '2' ); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub isTmpError { |
87
|
1
|
|
|
1
|
1
|
926
|
my $self = shift; |
88
|
1
|
|
|
|
|
5
|
my $first = substr $self->{hash}->{CODE}, 0, 1; |
89
|
1
|
|
|
|
|
7
|
return ( $first eq '4' ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub isPending { |
94
|
2
|
|
|
2
|
1
|
13
|
my $self = shift; |
95
|
2
|
100
|
|
|
|
9
|
if ( defined $self->{hash}->{PENDING} ) { |
96
|
1
|
|
|
|
|
6
|
return int( $self->{hash}->{PENDING} ); |
97
|
|
|
|
|
|
|
} |
98
|
1
|
|
|
|
|
5
|
return 0; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |