| 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
| |||||||||||
| 14 | 0 | ▶ | die "Missing wrapper" unless $params{wrapper}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | ▶ | die "Missing id" unless $params{id}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 0 | ▶ | die "Missing domain" unless $params{domain}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | if ( !$response->error ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | if ( !$response->error ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 77 | 0 | ▶ | return unless $self->{_valid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 87 | 0 | ▶ | return unless $self->{_valid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 111 | 0 | ▶ | return unless $self->{_valid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 121 | 0 | ▶ | return unless $self->{_valid}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 122 | |||||||||||
| 123 | 0 | return $self->{_properties}{action}; | |||||||||
| 124 | } | ||||||||||
| 125 | |||||||||||
| 126 | 36 | 1; | |||||||||