Shutterstock/Subscription.pm

filter: Statementstmt 74.3% 29 / 39 Branchbran n/a Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 60.9% 39 / 64 CC 4 SCAR 19.5
CC
4
Cov
62%
sizes_for_licensing
20.0
is_active
2.0
is_expired
2.0
CRAP 7.0
« Shutterstock/SearchResult/Video.pm ↑ Summary Shutterstock/DeferredData.pm »
1 package WebService::Shutterstock::Subscription;
2 {
3 2 $WebService::Shutterstock::Subscription::VERSION = '0.006';
4 }
5  
6 # ABSTRACT: Class representing a subscription for a specific Shutterstock customer
7  
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use JSON qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use WebService::Shutterstock::LicensedImage;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use WebService::Shutterstock::AuthedClient;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 with 'WebService::Shutterstock::AuthedClient';
17  
18  
19 2 has id => ( is => 'ro', required => 1, init_arg => 'subscription_id' );
20 2 my @fields = qw(
21 unix_expiration_time
22 current_allotment
23 description
24 license
25 sizes
26 site
27 expiration_time
28 price_per_download
29 );
30 2 foreach my $f(@fields){
31 16 has $f => ( is => 'ro' );
32 }
33  
34  
35 0 ▶sub sizes_for_licensing {
Subroutine sizes_for_licensing: not called CC=4 SCAR=30.0
Pod documented
36 0 my $self = shift;
37 0 my %uniq;
38 return
39 0 grep { !$uniq{$_}++ }
40 0 map { $_->{name} }
41 0 ▶ grep { $_->{name} ne 'supersize' && (!$_->{format} || $_->{format} ne 'tiff') }
Condition0%0/6
$_->{'name'} ne 'supersize' && (!$_->{'format'} || $_->{'format'} ne 'tiff')
!ll&&!rl&&r
000
not $_->{"format"} or $_->{"format"} ne "tiff"
l!l&&r!l&&!r
000
MC/DC0%0/3
$_->{'name'} ne 'supersize' && (!$_->{'format'} || $_->{'format'} ne 'tiff')
$_->{'name'} ne 'supersize' not $_->{"format"} $_->{"format"} ne "tiff"
Truth table0%0/4
A && not(B) or C
A= $_->{'name'} ne 'supersize'B= not $_->{"format"}C= $_->{"format"} ne "tiff"
ABCresult
0XX0
1000
11X1
1011
42 0 ▶ values %{ $self->sizes || {} };
Condition0%0/2
$self->sizes || {}
l!l
00
MC/DC0%0/1
$self->sizes || {}
$self->sizes
Truth table0%0/2
A
A= $self->sizes
Aresult
11
00
43 }
44  
45  
46 0 ▶sub is_active {
Subroutine is_active: not called CC=1 SCAR=6.9
Pod documented
47 0 my $self = shift;
48 0 return $self->unix_expiration_time > time;
49 }
50  
51  
52 0 ▶sub is_expired {
Subroutine is_expired: not called CC=1 SCAR=6.9
Pod documented
53 0 return !shift->is_active;
54 }
55  
56 2 1;
57  
58 __END__
« Shutterstock/SearchResult/Video.pm ↑ Summary Shutterstock/DeferredData.pm »