File Coverage

blib/lib/WWW/Giraffi/API/MonitoringData.pm
Criterion Covered Total %
statement 12 29 41.3
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 3 3 100.0
total 19 41 46.3


line stmt bran cond sub pod time code
1             package WWW::Giraffi::API::MonitoringData;
2              
3 1     1   4 use strict;
  1         2  
  1         32  
4 1     1   5 use warnings;
  1         2  
  1         22  
5 1     1   4 use Time::Piece;
  1         2  
  1         7  
6              
7 1     1   62 use parent qw(WWW::Giraffi::API::Request);
  1         2  
  1         6  
8              
9             our $VERSION = '0.2_04';
10              
11             sub all {
12              
13 0     0 1   my ( $self, $other_options ) = @_;
14 0           return $self->search(undef, $other_options);
15             }
16              
17             sub search {
18 0     0 1   my ( $self, $conditions, $other_options ) = @_;
19 0           my $arrayref = $self->get( "monitoringdata.json", $conditions, $other_options );
20 0 0         if ($self->use_time_piece) {
21 0           my $tmp_arrayref = [];
22 0           foreach my $ref(@{$arrayref}) {
  0            
23 0           $ref->{checked_at} = localtime($ref->{checked_at});
24 0           $ref->{compared_at} = localtime($ref->{compared_at});
25 0           $ref->{created_at} = localtime($ref->{created_at});
26 0           push @{$tmp_arrayref}, $ref;
  0            
27             }
28 0           $arrayref = $tmp_arrayref;
29             }
30 0           return $arrayref;
31             }
32              
33             sub create {
34 0     0 1   my ( $self, $conditions, $other_options ) = @_;
35 0           return $self->post( sprintf("%s/internal/nodelayed", $self->monitoringdata_endpoint), undef, { internal => $conditions }, $other_options );
36             }
37              
38             1;
39              
40             __END__