File Coverage

lib/Webservice/OVH/Email.pm
Criterion Covered Total %
statement 12 22 54.5
branch 0 4 0.0
condition n/a
subroutine 4 6 66.6
pod 1 1 100.0
total 17 33 51.5


line stmt bran cond sub pod time code
1             package Webservice::OVH::Email;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             Webservice::OVH::Email
8              
9             =head1 SYNOPSIS
10              
11             use Webservice::OVH;
12            
13             my $ovh = Webservice::OVH->new_from_json("credentials.json");
14            
15             my $email_domains = $ovh->email->domains->domains;
16            
17             foreach my $email_domain (@$email_domains) {
18            
19             print $email_domain->name;
20             }
21              
22             =head1 DESCRIPTION
23              
24             Module that support limited access to email methods of the ovh api
25             The methods that are supported are marked as deprecated by ovh.
26             But unitl now they didn't produce a alternative.
27             For now the MX order Methods are functional.
28              
29             =head1 METHODS
30              
31             =cut
32              
33 36     36   266 use strict;
  36         77  
  36         1139  
34 36     36   185 use warnings;
  36         80  
  36         1078  
35 36     36   185 use Carp qw{ carp croak };
  36         77  
  36         2362  
36              
37             our $VERSION = 0.46;
38              
39 36     36   18009 use Webservice::OVH::Email::Domain;
  36         126  
  36         5504  
40              
41             =head2 _new
42              
43             Internal Method to create the email object.
44             This method is not ment to be called external.
45              
46             =over
47              
48             =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object
49              
50             =item * Return: L<Webservice::OVH::Email>
51              
52             =item * Synopsis: Webservice::OVH::Email->_new($ovh_api_wrapper, $self);
53              
54             =back
55              
56             =cut
57              
58             sub _new {
59              
60 0     0     my ( $class, %params ) = @_;
61              
62 0 0         die "Missing module" unless $params{module};
63 0 0         die "Missing wrapper" unless $params{wrapper};
64 0           my $module = $params{module};
65 0           my $api_wrapper = $params{wrapper};
66              
67 0           my $self = bless { module => $module, _api_wrapper => $api_wrapper }, $class;
68              
69 0           $self->{_domain} = Webservice::OVH::Email::Domain->_new( wrapper => $api_wrapper, module => $module );
70              
71 0           return $self;
72             }
73              
74             =head2 domain
75              
76             Gives Acces to the /email/domain/ methods of the ovh api
77              
78             =over
79              
80             =item * Return: L<Webservice::OVH::Email::Domain>
81              
82             =item * Synopsis: $ovh->order->email
83              
84             =back
85              
86             =cut
87              
88             sub domain {
89              
90 0     0 1   my ($self) = @_;
91              
92 0           return $self->{_domain};
93             }
94              
95             1;