MailboxOrg/API/Invoice.pm

filter: Statementstmt 55.8% 19 / 34 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 100% 3 / 3 totaltotal 50.0% 27 / 54 CC 5 SCAR 14.1
CC
5
Cov
45%
_rpc
6.0
list
6.0
get
6.0
CRAP 4.1
« MailboxOrg/API/Blacklist.pm ↑ Summary MailboxOrg/API/Utils.pm »
1 package WWW::MailboxOrg::API::Invoice;
2  
3 # ABSTRACT: Invoice API
4  
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use MooX::Singleton;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Params::ValidationCompiler qw(validation_for);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Types::Standard qw(Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '0.001';
12  
13 1 has client => (
14 is => 'ro',
15 required => 1,
16 weak_ref => 1,
17 );
18  
19 sub _rpc {
20 0 ▶ my ($self, $method, @params) = @_;
Subroutine _rpc: not called CC=2 SCAR=17.9
21 0 ▶ my $client = $self->client or croak "No client set";
Branch: 1 branch
BranchTrueFalseTotal
my $client = $self->client or croak("No client set") 0 0 0
22 0 return $client->call($method, @params);
23 }
24  
25 1 my %validators = (
26 list => validation_for(
27 params => {
28 account => { type => Str, optional => 1 },
29 },
30 ),
31 get => validation_for(
32 params => {
33 account => { type => Str, optional => 0 },
34 invoice => { type => Str, optional => 0 },
35 },
36 ),
37 download => validation_for(
38 params => {
39 account => { type => Str, optional => 0 },
40 invoice => { type => Str, optional => 0 },
41 },
42 ),
43 );
44  
45 sub list {
46 0 ▶ my ($self, %params) = @_;
Subroutine list: not called CC=2 SCAR=17.9
Pod documented
47 0 my $v = $validators{'list'};
48 0 ▶ %params = $v->(%params) if $v;
Branch: 1 branch
BranchTrueFalseTotal
if $v 0 0 0
49 0 return $self->_rpc('invoice.list', \%params);
50 }
51  
52 sub get {
53 0 ▶ my ($self, %params) = @_;
Subroutine get: not called CC=2 SCAR=17.9
Pod documented
54 0 my $v = $validators{'get'};
55 0 ▶ %params = $v->(%params) if $v;
Branch: 1 branch
BranchTrueFalseTotal
if $v 0 0 0
56 0 return $self->_rpc('invoice.get', \%params);
57 }
58  
59 sub download {
60 0 ▶ my ($self, %params) = @_;
Subroutine download: not called CC=2 SCAR=17.9
Pod documented
61 0 my $v = $validators{'download'};
62 0 ▶ %params = $v->(%params) if $v;
Branch: 1 branch
BranchTrueFalseTotal
if $v 0 0 0
63 0 return $self->_rpc('invoice.download', \%params);
64 }
65  
66 1 1;
67  
68 __END__
69  
70 =pod
71  
72 =encoding UTF-8
73  
74 =head1 NAME
75  
76 WWW::MailboxOrg::API::Invoice - Invoice API
77  
78 =head1 VERSION
79  
80 version 0.001
81  
82 =head1 NAME
83  
84 WWW::MailboxOrg::API::Invoice - Invoice API
85  
86 =head2 list
87  
88 my $invoices = $api->invoice->list;
89 $api->invoice->list(account => 'admin@example.com');
90  
91 List invoices. Optional C<account> filter.
92  
93 =head2 get
94  
95 $api->invoice->get(
96 account => 'admin@example.com',
97 invoice => 'INV-2024-001',
98 );
99  
100 Get invoice details. Required: C<account>, C<invoice>.
101  
102 =head2 download
103  
104 $api->invoice->download(
105 account => 'admin@example.com',
106 invoice => 'INV-2024-001',
107 );
108  
109 Download an invoice. Required: C<account>, C<invoice>.
110  
111 =cut
112  
113 =head1 SUPPORT
114  
115 =head2 Issues
116  
117 Please report bugs and feature requests on GitHub at
118 L<https://github.com/getty/p5-www-mailboxorg/issues>.
119  
120 =head2 IRC
121  
122 Join C<#perl-help> on C<irc.perl.org> or message Getty directly.
123  
124 =head1 CONTRIBUTING
125  
126 Contributions are welcome! Please fork the repository and submit a pull request.
127  
128 =head1 AUTHOR
129  
130 Torsten Raudssus <getty@cpan.org>
131  
132 =head1 COPYRIGHT AND LICENSE
133  
134 This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> L<https://raudssus.de/>.
135  
136 This is free software; you can redistribute it and/or modify it under
137 the same terms as the Perl 5 programming language system itself.
138  
139 =cut
« MailboxOrg/API/Blacklist.pm ↑ Summary MailboxOrg/API/Utils.pm »