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.026';
3 9     9   56 use namespace::autoclean;
  9         16  
  9         53  
4              
5 9     9   682 use Moo;
  9         18  
  9         39  
6 9     9   2741 use Types::Standard qw(Str ArrayRef Enum);
  9         32  
  9         84  
7 9     9   5935 use Carp qw(croak);
  9         17  
  9         399  
8 9     9   55 use JSON::MaybeXS;
  9         13  
  9         2313  
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;