Monzo/Pot.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 97.4% 38 / 39 CC 2 SCAR 2.3
CC
2
Cov
97%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Monzo/Exception.pm ↑ Summary Monzo/Webhook.pm »
1 package Business::Monzo::Pot;
2  
3 =head1 NAME
4  
5 Business::Monzo::Pot
6  
7 =head1 DESCRIPTION
8  
9 A class for a Monzo pot, extends L<Business::Monzo::Resource>
10  
11 =cut
12  
13 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 11 extends 'Business::Monzo::Resource';
18 11 with 'Business::Monzo::Utils';
19 11 with 'Business::Monzo::Currency';
20  
21 11 ▶use Types::Standard qw/ :all /;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 11 ▶use Business::Monzo::Merchant;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 11 ▶use DateTime::Format::DateParse;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 =head1 ATTRIBUTES
26  
27 The Pot class has the following attributes (with their type).
28  
29 id (Str)
30 name (Str)
31 style (Str)
32 balance (Int)
33 currency (Data::Currency)
34 created (DateTime)
35 updated (DateTime)
36 deleted (Bool)
37  
38 Note that when a Str is passed to ->currency this will be coerced to a
39 Data::Currency object,
40  
41 =cut
42  
43 11 has [ qw/ id name style / ] => (
44 is => 'ro',
45 isa => Str,
46 required => 1,
47 );
48  
49 11 has [ qw/ balance / ] => (
50 is => 'ro',
51 isa => Int,
52 );
53  
54 has [ qw/ created updated / ] => (
55 is => 'ro',
56 isa => Maybe[InstanceOf['DateTime']],
57 4 ▶ coerce => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
58 4 my ( $args ) = @_;
59  
60 4 ▶ if ( ! ref( $args ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args) 4 0 4
61 4 $args = DateTime::Format::DateParse->parse_datetime( $args );
62 }
63  
64 4 return $args;
65 },
66 11 );
67  
68 11 has [ qw/ deleted / ] => (
69 is => 'ro',
70 isa => Any,
71 );
72  
73 =head1 SEE ALSO
74  
75 L<Business::Monzo>
76  
77 L<Business::Monzo::Resource>
78  
79 =head1 AUTHOR
80  
81 Lee Johnson - C<leejo@cpan.org>
82  
83 =head1 LICENSE
84  
85 This library is free software; you can redistribute it and/or modify it under
86 the same terms as Perl itself. If you would like to contribute documentation,
87 features, bug fixes, or anything else then please raise an issue / pull request:
88  
89 https://github.com/leejo/business-monzo
90  
91 =cut
92  
93 11 1;
94  
95 # vim: ts=4:sw=4:et
« Monzo/Exception.pm ↑ Summary Monzo/Webhook.pm »