Zuora/QueryIterator.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::Zuora::QueryIterator;
2 use Moose;
3 use MooseX::Types::Moose qw/ArrayRef Str/;
4 use namespace::autoclean;
5  
6 has _api => ( is => 'ro', isa => 'Net::Zuora', required => 1 );
7 has _records => (
8 isa => ArrayRef, is => 'ro', required => 1, init_arg => 'records',
9 traits => ['Array'],
10 handles => {
11 next => 'shift',
12 all => 'elements',
13 is_empty => 'is_empty',
14 },
15 );
16 has type => ( isa => Str, is => 'ro', required => 1 );
17  
18 override BUILDARGS => sub {
19 my $args = super();
20 my $class_to_inflate = $args->{_api}->_load_object_class($args->{type});
21 $args->{records} ||= [];
22 $args->{records} = [ $args->{records} ] if ref($args->{records}) ne 'ARRAY';
23 $args->{records} = [
24 map {
25 $class_to_inflate->new(
26 %$_,
27 _api => $args->{_api},
28 _created => 1,
29 )
30 }
31 @{ $args->{records} }
32 ];
33 return $args;
34 };
35  
36 1;
37