| 1 | package TMDB::Company; | ||||||||||||
| 2 | |||||||||||||
| 3 | ####################### | ||||||||||||
| 4 | # LOAD CORE MODULES | ||||||||||||
| 5 | ####################### | ||||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 3 | ▶ | use warnings FATAL => 'all'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 3 | ▶ | use Carp qw(croak carp); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | ####################### | ||||||||||||
| 11 | # LOAD CPAN MODULES | ||||||||||||
| 12 | ####################### | ||||||||||||
| 13 | 3 | ▶ | use Object::Tiny qw(id session); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 3 | ▶ | use Params::Validate qw(validate_with :types); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 15 | |||||||||||||
| 16 | ####################### | ||||||||||||
| 17 | # LOAD DIST MODULES | ||||||||||||
| 18 | ####################### | ||||||||||||
| 19 | 3 | ▶ | use TMDB::Session; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | |||||||||||||
| 21 | ####################### | ||||||||||||
| 22 | # VERSION | ||||||||||||
| 23 | ####################### | ||||||||||||
| 24 | 3 | our $VERSION = '1.3.0'; | |||||||||||
| 25 | |||||||||||||
| 26 | ####################### | ||||||||||||
| 27 | # PUBLIC METHODS | ||||||||||||
| 28 | ####################### | ||||||||||||
| 29 | |||||||||||||
| 30 | ## ==================== | ||||||||||||
| 31 | ## Constructor | ||||||||||||
| 32 | ## ==================== | ||||||||||||
| 33 | 1 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 34 | 1 | my $class = shift; | |||||||||||
| 35 | 1 | my %opts = validate_with( | |||||||||||
| 36 | params => \@_, | ||||||||||||
| 37 | spec => { | ||||||||||||
| 38 | session => { | ||||||||||||
| 39 | type => OBJECT, | ||||||||||||
| 40 | isa => 'TMDB::Session', | ||||||||||||
| 41 | }, | ||||||||||||
| 42 | id => { | ||||||||||||
| 43 | type => SCALAR, | ||||||||||||
| 44 | }, | ||||||||||||
| 45 | }, | ||||||||||||
| 46 | ); | ||||||||||||
| 47 | |||||||||||||
| 48 | 1 | my $self = $class->SUPER::new(%opts); | |||||||||||
| 49 | 1 | return $self; | |||||||||||
| 50 | } ## end sub new | ||||||||||||
| 51 | |||||||||||||
| 52 | ## ==================== | ||||||||||||
| 53 | ## INFO | ||||||||||||
| 54 | ## ==================== | ||||||||||||
| 55 | 0 | ▶ | sub info { | ||||||||||
|
Subroutine
info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 56 | 0 | my $self = shift; | |||||||||||
| 57 | 0 | return $self->session->talk( | |||||||||||
| 58 | { | ||||||||||||
| 59 | method => 'company/' . $self->id(), | ||||||||||||
| 60 | } | ||||||||||||
| 61 | ); | ||||||||||||
| 62 | } ## end sub info | ||||||||||||
| 63 | |||||||||||||
| 64 | ## ==================== | ||||||||||||
| 65 | ## VERSION | ||||||||||||
| 66 | ## ==================== | ||||||||||||
| 67 | 0 | ▶ | sub version { | ||||||||||
|
Subroutine
version: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 68 | 0 | my ($self) = @_; | |||||||||||
| 69 | 0 | ▶ | my $response = $self->session->talk( | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 70 | { | ||||||||||||
| 71 | method => 'company/' . $self->id(), | ||||||||||||
| 72 | want_headers => 1, | ||||||||||||
| 73 | } | ||||||||||||
| 74 | ) or return; | ||||||||||||
| 75 | 0 | ▶ | my $version = $response->{etag} || q(); | ||||||||||
|
Condition0%0/2
$response->{'etag'} || ''
MC/DC0%0/1
$response->{'etag'} || ''
$response->{'etag'}
Truth table0%0/2
A
A= $response->{'etag'}
| |||||||||||||
| 76 | 0 | $version =~ s{"}{}gx; | |||||||||||
| 77 | 0 | return $version; | |||||||||||
| 78 | } ## end sub version | ||||||||||||
| 79 | |||||||||||||
| 80 | ## ==================== | ||||||||||||
| 81 | ## MOVIES | ||||||||||||
| 82 | ## ==================== | ||||||||||||
| 83 | 0 | ▶ | sub movies { | ||||||||||
|
Subroutine
movies: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 84 | 0 | my ( $self, $max_pages ) = @_; | |||||||||||
| 85 | 0 | return $self->session->paginate_results( | |||||||||||
| 86 | { | ||||||||||||
| 87 | method => 'company/' . $self->id() . '/movies', | ||||||||||||
| 88 | max_pages => $max_pages, | ||||||||||||
| 89 | } | ||||||||||||
| 90 | ); | ||||||||||||
| 91 | } ## end sub movies | ||||||||||||
| 92 | |||||||||||||
| 93 | ## ==================== | ||||||||||||
| 94 | ## INFO HELPERS | ||||||||||||
| 95 | ## ==================== | ||||||||||||
| 96 | |||||||||||||
| 97 | # Name | ||||||||||||
| 98 | 0 | ▶ | sub name { | ||||||||||
|
Subroutine
name: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 99 | 0 | my ($self) = @_; | |||||||||||
| 100 | 0 | my $info = $self->info(); | |||||||||||
| 101 | 0 | ▶ | return unless $info; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 102 | 0 | ▶ | return $info->{name} || q(); | ||||||||||
|
Condition0%0/2
$info->{'name'} || ''
MC/DC0%0/1
$info->{'name'} || ''
$info->{'name'}
Truth table0%0/2
A
A= $info->{'name'}
| |||||||||||||
| 103 | } ## end sub name | ||||||||||||
| 104 | |||||||||||||
| 105 | # Logo | ||||||||||||
| 106 | 0 | ▶ | sub logo { | ||||||||||
|
Subroutine
logo: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 107 | 0 | my ($self) = @_; | |||||||||||
| 108 | 0 | my $info = $self->info(); | |||||||||||
| 109 | 0 | ▶ | return unless $info; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 110 | 0 | ▶ | return $info->{logo_path} || q(); | ||||||||||
|
Condition0%0/2
$info->{'logo_path'} || ''
MC/DC0%0/1
$info->{'logo_path'} || ''
$info->{'logo_path'}
Truth table0%0/2
A
A= $info->{'logo_path'}
| |||||||||||||
| 111 | } ## end sub logo | ||||||||||||
| 112 | |||||||||||||
| 113 | # Image | ||||||||||||
| 114 | 0 | ▶ | sub image { return shift->logo(); } | ||||||||||
|
Subroutine
image: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 115 | |||||||||||||
| 116 | ####################### | ||||||||||||
| 117 | 3 | 1; | |||||||||||