| 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')
not $_->{"format"} or $_->{"format"} ne "tiff"
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"
| |||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | values %{ $self->sizes || {} }; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->sizes || {}
MC/DC0%0/1
$self->sizes || {}
$self->sizes
Truth table0%0/2
A
A= $self->sizes
| |||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||