File Coverage

blib/lib/Consul/Session.pm
Criterion Covered Total %
statement 15 18 83.3
branch 0 12 0.0
condition n/a
subroutine 5 7 71.4
pod 0 1 0.0
total 20 38 52.6


line stmt bran cond sub pod time code
1             package Consul::Session;
2             $Consul::Session::VERSION = '0.027';
3 9     9   58 use namespace::autoclean;
  9         16  
  9         52  
4              
5 9     9   647 use Moo;
  9         14  
  9         42  
6 9     9   2717 use Types::Standard qw(Str ArrayRef Enum);
  9         17  
  9         63  
7 9     9   6328 use Carp qw(croak);
  9         23  
  9         524  
8 9     9   54 use JSON::MaybeXS;
  9         15  
  9         2451  
9              
10             has name => ( is => 'ro', isa => Str );
11             has behavior => ( is => 'ro', isa => Enum[qw(release delete)] );
12             has ttl => ( is => 'ro', isa => Str );
13             has node => ( is => 'ro', isa => Str );
14             has checks => ( is => 'ro', isa => ArrayRef[Str] );
15             has lock_delay => ( is => 'ro', isa => Str );
16              
17 0     0 0   sub to_json { shift->_json }
18             has _json => ( is => 'lazy', isa => Str );
19             sub _build__json {
20 0     0     my ($self) = @_;
21 0 0         encode_json({
    0          
    0          
    0          
    0          
    0          
22             defined $self->lock_delay ? ( LockDelay => $self->lock_delay ) : (),
23             defined $self->node ? ( Node => $self->node ) : (),
24             defined $self->name ? ( Name => $self->name ) : (),
25             defined $self->checks ? ( Checks => $self->checks ) : (),
26             defined $self->behavior ? ( Behavior => $self->behavior ) : (),
27             defined $self->ttl ? ( TTL => $self->ttl ) : (),
28             });
29             }
30              
31             1;