File Coverage

blib/lib/LINE/Bot/API/Response/Common.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 4 0.0
total 25 29 86.2


line stmt bran cond sub pod time code
1             package LINE::Bot::API::Response::Common;
2 53     53   2104 use strict;
  53         98  
  53         2145  
3 53     53   242 use warnings;
  53         107  
  53         2629  
4              
5 53     53   24222 use LINE::Bot::API::Response::Error;
  53         179  
  53         9274  
6              
7             sub new {
8 103     103 0 266933 my($class, %args) = @_;
9 103         479 my $self = bless { %args }, $class;
10 103 100       552 bless $self, 'LINE::Bot::API::Response::Error' unless $self->is_success;
11 103         642 $self;
12             }
13              
14 205     205 0 14734 sub is_success { $_[0]->{http_status} == 200 }
15 102     102 0 5363 sub http_status { $_[0]->{http_status} }
16 1     1 0 8 sub x_line_request_id { $_[0]->{http_headers}->header('X-Line-Request-Id') }
17              
18             1;