File Coverage

blib/lib/Business/NAB/Australian/DirectEntry/Report/HeaderRecord.pm
Criterion Covered Total %
statement 26 26 100.0
branch 2 2 100.0
condition n/a
subroutine 9 9 100.0
pod 0 1 0.0
total 37 38 97.3


line stmt bran cond sub pod time code
1             package Business::NAB::Australian::DirectEntry::Report::HeaderRecord;
2             $Business::NAB::Australian::DirectEntry::Report::HeaderRecord::VERSION = '0.03';
3             =head1 NAME
4              
5             Business::NAB::Australian::DirectEntry::Report::HeaderRecord
6              
7             =head1 SYNOPSIS
8              
9             =head1 DESCRIPTION
10              
11             Class for header record in the Australian Direct Entry Report file
12              
13             =cut;
14              
15 2     2   906811 use strict;
  2         4  
  2         121  
16 2     2   13 use warnings;
  2         4  
  2         127  
17 2     2   12 use feature qw/ signatures /;
  2         5  
  2         261  
18              
19 2     2   512 use Moose;
  2         511191  
  2         22  
20             extends 'Business::NAB::CSV';
21 2     2   20397 no warnings qw/ experimental::signatures /;
  2         7  
  2         152  
22              
23 2         1110 use Business::NAB::Types qw/
24             add_max_string_attribute
25 2     2   922 /;
  2         12  
26              
27             =head1 ATTRIBUTES
28              
29             All are Str types, required, except where stated
30              
31             =over
32              
33             =item bank_name
34              
35             =item product_name
36              
37             =item report_name
38              
39             =item run_date (NAB::Type::Date)
40              
41             =item run_time
42              
43             =item fund_id
44              
45             =item customer_name
46              
47             =item import_file_name
48              
49             =item payment_date (NAB::Type::Date)
50              
51             =item batch_no_links
52              
53             =item export_file_name
54              
55             =item de_user_id
56              
57             =item me_id
58              
59             =item report_file_name
60              
61             =back
62              
63             =cut
64              
65 7     7   30 sub _record_type { '00' }
66              
67             sub _attributes {
68 9     9   104 return qw/
69             bank_name
70             product_name
71             report_name
72             run_date
73             run_time
74             fund_id
75             customer_name
76             import_file_name
77             payment_date
78             batch_no_links
79             export_file_name
80             de_user_id
81             me_id
82             report_file_name
83             /;
84             }
85              
86             has [
87             qw/
88             run_date payment_date
89             /
90             ] => (
91             is => 'ro',
92             isa => 'NAB::Type::Date',
93             required => 1,
94             coerce => 1,
95             );
96              
97             foreach my $str_attr (
98             grep { $_ !~ /date/ } __PACKAGE__->_attributes
99             ) {
100             __PACKAGE__->add_max_string_attribute(
101             $str_attr,
102             is => 'ro',
103             required => 1,
104             );
105             }
106              
107 4     4 0 91 sub to_record ( $self ) {
  4         11  
  4         10  
108              
109             my $aoa = [ [
110             map {
111 4 100       22 $_ =~ /date/
  60         1315  
112             ? $self->$_->dmy( '' )
113             : $self->$_
114             ;
115             } '_record_type',
116             $self->_attributes,
117             ] ];
118              
119 4         113 return $self->SUPER::to_record( $aoa );
120             }
121              
122             __PACKAGE__->meta->make_immutable;