File Coverage

blib/lib/WebService/Mattermost/V4/API/Object/Role/Timestamps.pm
Criterion Covered Total %
statement 8 10 80.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod n/a
total 11 14 78.5


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Object::Role::Timestamps;
2              
3             # ABSTRACT: Adds common timestamp fields to an object.
4              
5 7     7   3763 use Moo::Role;
  7         17  
  7         45  
6 7     7   3029 use Types::Standard qw(InstanceOf Int Maybe);
  7         15  
  7         53  
7              
8             with qw(
9             WebService::Mattermost::V4::API::Object::Role::CreatedAt
10             WebService::Mattermost::V4::API::Object::Role::UpdatedAt
11             );
12              
13             ################################################################################
14              
15             has [ qw(
16             delete_at
17             ) ] => (is => 'ro', isa => Maybe[Int], lazy => 1, builder => 1);
18              
19             has [ qw(
20             deleted_at
21             ) ] => (is => 'ro', isa => Maybe[InstanceOf['DateTime']], lazy => 1, builder => 1);
22              
23             ################################################################################
24              
25             sub _build_delete_at {
26 0     0   0     my $self = shift;
27              
28 0         0     return $self->raw_data->{delete_at};
29             }
30              
31             sub _build_deleted_at {
32 1     1   1366     my $self = shift;
33              
34 1         8     return $self->_from_epoch($self->raw_data->{delete_at});
35             }
36              
37             ################################################################################
38              
39             1;
40              
41             __END__
42            
43             =pod
44            
45             =encoding UTF-8
46            
47             =head1 NAME
48            
49             WebService::Mattermost::V4::API::Object::Role::Timestamps - Adds common timestamp fields to an object.
50            
51             =head1 VERSION
52            
53             version 0.26
54            
55             =head1 DESCRIPTION
56            
57             Attach common timestamps to a v4::Object object.
58            
59             =head2 ATTRIBUTES
60            
61             =over 4
62            
63             =item C<delete_at>
64            
65             UNIX timestamp.
66            
67             =item C<deleted_at>
68            
69             C<DateTime> object.
70            
71             =back
72            
73             =head1 SEE ALSO
74            
75             =over 4
76            
77             =item L<WebService::Mattermost::V4::API::Object::Role::CreatedAt>
78            
79             =back
80            
81             =head1 AUTHOR
82            
83             Mike Jones <mike@netsplit.org.uk>
84            
85             =head1 COPYRIGHT AND LICENSE
86            
87             This software is Copyright (c) 2020 by Mike Jones.
88            
89             This is free software, licensed under:
90            
91             The MIT (X11) License
92            
93             =cut
94