| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Webservice::OVH::Email::Domain::Domain::Task::Redirection; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 36 |  |  | 36 |  | 258 | use strict; | 
|  | 36 |  |  |  |  | 96 |  | 
|  | 36 |  |  |  |  | 1059 |  | 
| 4 | 36 |  |  | 36 |  | 205 | use warnings; | 
|  | 36 |  |  |  |  | 81 |  | 
|  | 36 |  |  |  |  | 985 |  | 
| 5 | 36 |  |  | 36 |  | 195 | use Carp qw{ carp croak }; | 
|  | 36 |  |  |  |  | 112 |  | 
|  | 36 |  |  |  |  | 25357 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = 0.48; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | sub _new_existing { | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 0 |  |  | 0 |  |  | my ( $class, %params ) = @_; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 0 | 0 |  |  |  |  | die "Missing module"  unless $params{module}; | 
| 14 | 0 | 0 |  |  |  |  | die "Missing wrapper" unless $params{wrapper}; | 
| 15 | 0 | 0 |  |  |  |  | die "Missing id"      unless $params{id}; | 
| 16 | 0 | 0 |  |  |  |  | die "Missing domain"  unless $params{domain}; | 
| 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 | 0 |  |  |  |  | carp $response->error if $response->error; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 0 | 0 |  |  |  |  | if ( !$response->error ) { | 
| 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 |  |  |  |  |  |  | sub is_valid { | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 0 |  |  |  |  |  | $self->properties; | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  |  | return $self->{_valid},; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub properties { | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 0 | 0 |  |  |  |  | croak "Invalid" unless $self->{_valid}; | 
| 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 | 0 |  |  |  |  | carp $response->error if $response->error; | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 0 | 0 |  |  |  |  | if ( !$response->error ) { | 
| 62 |  |  |  |  |  |  |  | 
| 63 | 0 |  |  |  |  |  | my $porperties = $response->content; | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | } else { | 
| 66 |  |  |  |  |  |  |  | 
| 67 | 0 |  |  |  |  |  | $self->{_valid} = 0; | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | sub account { | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 75 |  |  |  |  |  |  |  | 
| 76 | 0 | 0 |  |  |  |  | $self->properties unless $self->{_properties}; | 
| 77 | 0 | 0 |  |  |  |  | return unless $self->{_valid}; | 
| 78 |  |  |  |  |  |  |  | 
| 79 | 0 |  |  |  |  |  | return $self->{_properties}{account}; | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | sub type { | 
| 83 |  |  |  |  |  |  |  | 
| 84 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 85 |  |  |  |  |  |  |  | 
| 86 | 0 | 0 |  |  |  |  | $self->properties unless $self->{_properties}; | 
| 87 | 0 | 0 |  |  |  |  | return unless $self->{_valid}; | 
| 88 |  |  |  |  |  |  |  | 
| 89 | 0 |  |  |  |  |  | return $self->{_properties}{type}; | 
| 90 |  |  |  |  |  |  | } | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | sub id { | 
| 93 |  |  |  |  |  |  |  | 
| 94 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 95 |  |  |  |  |  |  |  | 
| 96 | 0 |  |  |  |  |  | return $self->{_id}; | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | sub domain { | 
| 100 |  |  |  |  |  |  |  | 
| 101 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 102 |  |  |  |  |  |  |  | 
| 103 | 0 |  |  |  |  |  | return $self->{_domain}; | 
| 104 |  |  |  |  |  |  | } | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | sub date { | 
| 107 |  |  |  |  |  |  |  | 
| 108 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 0 | 0 |  |  |  |  | $self->properties unless $self->{_properties}; | 
| 111 | 0 | 0 |  |  |  |  | return unless $self->{_valid}; | 
| 112 |  |  |  |  |  |  |  | 
| 113 | 0 |  |  |  |  |  | return $self->{_properties}{date}; | 
| 114 |  |  |  |  |  |  | } | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | sub action { | 
| 117 |  |  |  |  |  |  |  | 
| 118 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 119 |  |  |  |  |  |  |  | 
| 120 | 0 | 0 |  |  |  |  | $self->properties unless $self->{_properties}; | 
| 121 | 0 | 0 |  |  |  |  | return unless $self->{_valid}; | 
| 122 |  |  |  |  |  |  |  | 
| 123 | 0 |  |  |  |  |  | return $self->{_properties}{action}; | 
| 124 |  |  |  |  |  |  | } | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | 1; |