File Coverage

lib/Business/Fixflo/Envelope.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition 2 2 100.0
subroutine 5 5 100.0
pod 0 1 0.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Business::Fixflo::Envelope;
2              
3             =head1 NAME
4              
5             Business::Fixflo::Envelope
6              
7             =head1 DESCRIPTION
8              
9             A class for a fixflo envelope, extends L
10              
11             =cut
12              
13 16     16   116 use strict;
  16         35  
  16         516  
14 16     16   89 use warnings;
  16         47  
  16         379  
15              
16 16     16   81 use Moo;
  16         42  
  16         84  
17 16     16   5601 use Business::Fixflo::Exception;
  16         36  
  16         3102  
18              
19             extends 'Business::Fixflo::Resource';
20              
21             =head1 ATTRIBUTES
22              
23             Entity
24             Errors
25             HttpStatusCode
26             HttpStatusCodeDesc
27             Messages
28              
29             There attributes are all required. When a Business::Fixflo::Envelope is
30             instantiated the Errors array will be checked and if it contains any data
31             a Business::Fixflo::Exception will be thrown.
32              
33             =cut
34              
35             has [ qw/
36             Entity
37             Errors
38             HttpStatusCode
39             HttpStatusCodeDesc
40             Messages
41             / ] => (
42             is => 'rw',
43             required => 1,
44             );
45              
46             sub BUILD {
47 4     4 0 41 my ( $self ) = @_;
48              
49 4 100 100     9 if ( @{ $self->Errors // [] } ) {
  4         36  
50             Business::Fixflo::Exception->throw({
51 1         2 message => join( ', ',@{ $self->Errors } ) ,
  1         16  
52             code => $self->HttpStatusCode,
53             response => $self->HttpStatusCodeDesc,
54             });
55             }
56              
57 3         21 return $self;
58             }
59              
60             =head1 SEE ALSO
61              
62             L
63              
64             =head1 AUTHOR
65              
66             Lee Johnson - C
67              
68             This library is free software; you can redistribute it and/or modify it under
69             the same terms as Perl itself. If you would like to contribute documentation,
70             features, bug fixes, or anything else then please raise an issue / pull request:
71              
72             https://github.com/Humanstate/business-fixflo
73              
74             =cut
75              
76             1;
77              
78             # vim: ts=4:sw=4:et