Webservice/OVH/Email/Domain/Domain/Task/Redirection.pm

filter: Statementstmt 18.0% 11 / 61 Branchbran 0.0% 0 / 34 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 3 / 12 Podpod 0.0% 0 / 8 totaltotal 12.1% 14 / 115 CC 18 SCAR 30.7
CC
18
Cov
12%
_new_existing
56.0
properties
20.0
account
12.0
CRAP 21.6
« Webservice/OVH/Cloud/Project/Instance/Group.pm ↑ Summary Webservice/OVH/Cloud/Project.pm »
1 package Webservice::OVH::Email::Domain::Domain::Task::Redirection;
2  
3 36 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 36 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 36 ▶use Carp qw{ carp croak };
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 36 our $VERSION = 0.48;
8  
9 0 ▶sub _new_existing {
Subroutine _new_existing: not called CC=7 SCAR=40.3
10  
11 0 my ( $class, %params ) = @_;
12  
13 0 ▶ die "Missing module" unless $params{module};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"module"} 0 0 0
14 0 ▶ die "Missing wrapper" unless $params{wrapper};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"wrapper"} 0 0 0
15 0 ▶ die "Missing id" unless $params{id};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"id"} 0 0 0
16 0 ▶ die "Missing domain" unless $params{domain};
Branch: 1 branch
BranchTrueFalseTotal
unless $params{"domain"} 0 0 0
17  
18 0 my $module = $params{module};
19 0 my $api_wrapper = $params{wrapper};
20 0 my $id = $params{id};
21 0 my $domain = $params{domain};
22 0 my $domain_name = $domain->name;
23  
24 0 my $response = $api_wrapper->rawCall( method => 'get', path => "/email/domain/$domain_name/task/redirection/$id", noSignature => 0 );
25 0 ▶ carp $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
26  
27 0 ▶ if ( !$response->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $response->error) { } 0 0 0
28  
29 0 my $porperties = $response->content;
30 0 my $self = bless { _module => $module, _valid => 1, _wrapper => $api_wrapper, _id => $id, _properties => $porperties, _domain => $domain }, $class;
31  
32 0 return $self;
33 } else {
34  
35 0 return undef;
36 }
37 }
38  
39 0 ▶sub is_valid {
Subroutine is_valid: not called CC=1 SCAR=6.9
Pod undocumented
40  
41 0 my ($self) = @_;
42  
43 0 $self->properties;
44  
45 0 return $self->{_valid},;
46 }
47  
48 0 ▶sub properties {
Subroutine properties: not called CC=4 SCAR=30.0
Pod undocumented
49  
50 0 my ($self) = @_;
51  
52 0 ▶ croak "Invalid" unless $self->{_valid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_valid"} 0 0 0
53  
54 0 my $domain_name = $self->{_domain}->name;
55 0 my $id = $self->{_id};
56 0 my $api_wrapper = $self->{_wrapper};
57  
58 0 my $response = $api_wrapper->rawCall( method => 'get', path => "/email/domain/$domain_name/task/redirection/$id", noSignature => 0 );
59 0 ▶ carp $response->error if $response->error;
Branch: 1 branch
BranchTrueFalseTotal
if $response->error 0 0 0
60  
61 0 ▶ if ( !$response->error ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $response->error) { } 0 0 0
62  
63 0 my $porperties = $response->content;
64  
65 } else {
66  
67 0 $self->{_valid} = 0;
68 }
69  
70 }
71  
72 0 ▶sub account {
Subroutine account: not called CC=3 SCAR=24.8
Pod undocumented
73  
74 0 my ($self) = @_;
75  
76 0 ▶ $self->properties unless $self->{_properties};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_properties"} 0 0 0
77 0 ▶ return unless $self->{_valid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_valid"} 0 0 0
78  
79 0 return $self->{_properties}{account};
80 }
81  
82 0 ▶sub type {
Subroutine type: not called CC=3 SCAR=24.8
Pod undocumented
83  
84 0 my ($self) = @_;
85  
86 0 ▶ $self->properties unless $self->{_properties};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_properties"} 0 0 0
87 0 ▶ return unless $self->{_valid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_valid"} 0 0 0
88  
89 0 return $self->{_properties}{type};
90 }
91  
92 0 ▶sub id {
Subroutine id: not called CC=1 SCAR=6.9
Pod undocumented
93  
94 0 my ($self) = @_;
95  
96 0 return $self->{_id};
97 }
98  
99 0 ▶sub domain {
Subroutine domain: not called CC=1 SCAR=6.9
Pod undocumented
100  
101 0 my ($self) = @_;
102  
103 0 return $self->{_domain};
104 }
105  
106 0 ▶sub date {
Subroutine date: not called CC=3 SCAR=24.8
Pod undocumented
107  
108 0 my ($self) = @_;
109  
110 0 ▶ $self->properties unless $self->{_properties};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_properties"} 0 0 0
111 0 ▶ return unless $self->{_valid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_valid"} 0 0 0
112  
113 0 return $self->{_properties}{date};
114 }
115  
116 0 ▶sub action {
Subroutine action: not called CC=3 SCAR=24.8
Pod undocumented
117  
118 0 my ($self) = @_;
119  
120 0 ▶ $self->properties unless $self->{_properties};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_properties"} 0 0 0
121 0 ▶ return unless $self->{_valid};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_valid"} 0 0 0
122  
123 0 return $self->{_properties}{action};
124 }
125  
126 36 1;
« Webservice/OVH/Cloud/Project/Instance/Group.pm ↑ Summary Webservice/OVH/Cloud/Project.pm »