File Coverage

blib/lib/WWW/Picnic/Result/DeliverySlots.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 2 2 100.0
total 18 18 100.0


line stmt bran cond sub pod time code
1             package WWW::Picnic::Result::DeliverySlots;
2             our $VERSION = '0.100';
3             our $AUTHORITY = 'cpan:GETTY';
4             # ABSTRACT: Collection of Picnic delivery slots
5              
6 2     2   13 use Moo;
  2         4  
  2         14  
7              
8             extends 'WWW::Picnic::Result';
9              
10 2     2   1896 use WWW::Picnic::Result::DeliverySlot;
  2         7  
  2         409  
11              
12              
13             has delivery_slots => (
14             is => 'ro',
15             lazy => 1,
16             default => sub {
17             my $self = shift;
18             my $slots = $self->_get('delivery_slots') || [];
19             return [ map { WWW::Picnic::Result::DeliverySlot->new($_) } @$slots ];
20             },
21             );
22              
23              
24             sub all_slots {
25 3     3 1 740 my ( $self ) = @_;
26 3         8 return @{ $self->delivery_slots };
  3         118  
27             }
28              
29              
30             sub available_slots {
31 2     2 1 1215 my ( $self ) = @_;
32 2         8 return grep { $_->is_available } $self->all_slots;
  4         184  
33             }
34              
35              
36             1;
37              
38             __END__