| 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 | use strict; | ||
| 34 | use warnings; | ||
| 35 | use Carp qw{ carp croak }; | ||
| 36 | |||
| 37 | our $VERSION = 0.47; | ||
| 38 | |||
| 39 | use Webservice::OVH::Email::Domain; | ||
| 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 | my ( $class, %params ) = @_; | ||
| 61 | |||
| 62 | die "Missing module" unless $params{module}; | ||
| 63 | die "Missing wrapper" unless $params{wrapper}; | ||
| 64 | my $module = $params{module}; | ||
| 65 | my $api_wrapper = $params{wrapper}; | ||
| 66 | |||
| 67 | my $self = bless { module => $module, _api_wrapper => $api_wrapper }, $class; | ||
| 68 | |||
| 69 | $self->{_domain} = Webservice::OVH::Email::Domain->_new( wrapper => $api_wrapper, module => $module ); | ||
| 70 | |||
| 71 | 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 | my ($self) = @_; | ||
| 91 | |||
| 92 | return $self->{_domain}; | ||
| 93 | } | ||
| 94 | |||
| 95 | 1; |