File Coverage

blib/lib/Net/Airbrake/Request.pm
Criterion Covered Total %
statement 16 16 100.0
branch 1 2 50.0
condition 4 8 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 26 32 81.2


line stmt bran cond sub pod time code
1             package Net::Airbrake::Request;
2              
3 2     2   8 use strict;
  2         2  
  2         56  
4 2     2   8 use warnings;
  2         3  
  2         43  
5              
6 2     2   7 use JSON qw(encode_json);
  2         2  
  2         9  
7 2     2   1075 use Class::Tiny qw(errors context environment session params);
  2         5274  
  2         10  
8              
9             sub to_json {
10 2     2 0 15 my $self = shift;
11              
12 2         21 encode_json({
13             notifier => {
14             name => "Net-Airbrake/$Net::Airbrake::VERSION",
15             version => "$Net::Airbrake::VERSION",
16             url => 'https://github.com/sixapart/Net-Airbrake',
17             },
18 2 50 50     9 errors => [ map { $_->to_hash } @{$self->errors || []} ],
  2   50     39  
      50        
      50        
19             environment => $self->environment || {},
20             context => $self->context || {},
21             session => $self->session || {},
22             params => $self->params || {},
23             });
24             }
25              
26             1;
27             __END__