line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
=encoding utf-8 |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Webservice::OVH::Order::Email::Domain |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Webservice::OVH; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $available_services = $ovh->order->email->domain->available_services; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Provides the possibility to order MX packaged. The api methods are deprecated, but no alternative is give at the moment. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use strict; |
25
|
36
|
|
|
36
|
|
600
|
use warnings; |
|
36
|
|
|
|
|
75
|
|
|
36
|
|
|
|
|
884
|
|
26
|
36
|
|
|
36
|
|
152
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
61
|
|
|
36
|
|
|
|
|
810
|
|
27
|
36
|
|
|
36
|
|
159
|
|
|
36
|
|
|
|
|
73
|
|
|
36
|
|
|
|
|
19503
|
|
28
|
|
|
|
|
|
|
our $VERSION = 0.47; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 _new |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Internal Method to create the Domain object. |
33
|
|
|
|
|
|
|
This method is not ment to be called directly. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Email::Domain> |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order::Email::Domain->_new($ovh_api_wrapper, $module); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=back |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my ( $class, %params ) = @_; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
|
die "Missing module" unless $params{module}; |
51
|
|
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
52
|
0
|
0
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
my $module = $params{module}; |
54
|
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
55
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper}, $class; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 _new |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns an array of available services. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order::Email::Domain->_new($ovh_api_wrapper, $module); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my ($self) = @_; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
79
|
0
|
|
|
0
|
0
|
|
my $response = $api->rawCall( method => 'get', path => "/order/email/domain", noSignature => 0 ); |
80
|
|
|
|
|
|
|
croak $response->error if $response->error; |
81
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return $response->content; |
83
|
0
|
0
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
=head2 allowed_durations |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Returns an array of allowed durations. |
88
|
|
|
|
|
|
|
DEPRECATED |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * Parameter: $domain - target domain for MX package, $offer - MX offer |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->email->domain->allowed_durations('mydomain.de', '100'); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my ($self, $domain, $offer) = @_; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
croak "Missing offer" unless $offer; |
106
|
|
|
|
|
|
|
croak "Missing domain" unless $domain; |
107
|
0
|
|
|
0
|
1
|
|
|
108
|
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "domain" => $domain, "offer" => $offer ); |
109
|
0
|
0
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
111
|
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => "/order/email/domain/new$filter", noSignature => 0 ); |
112
|
0
|
|
|
|
|
|
croak $response->error if $response->error; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
return $response->content; |
115
|
0
|
|
|
|
|
|
} |
116
|
0
|
0
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 allowed_durations |
118
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Returns information for a desired MX package. |
120
|
|
|
|
|
|
|
DEPRECATED |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Parameter: $domain - target domain for MX package, $offer - MX offer, $duration - allowed duration |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->email->domain->info('mydomain.de', '100', $allowed_durations->[0]); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=back |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
my ($self, $domain, $offer, $duration) = @_; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
croak "Missing offer" unless $offer; |
138
|
|
|
|
|
|
|
croak "Missing duration" unless $duration; |
139
|
|
|
|
|
|
|
croak "Missing domain" unless $domain; |
140
|
0
|
|
|
0
|
1
|
|
|
141
|
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "domain" => $domain, "offer" => $offer ); |
142
|
0
|
0
|
|
|
|
|
|
143
|
0
|
0
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
144
|
0
|
0
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf("/order/email/domain/new/%s%s", $duration, $filter), noSignature => 0 ); |
145
|
|
|
|
|
|
|
croak $response->error if $response->error; |
146
|
0
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
return $response->content; |
148
|
0
|
|
|
|
|
|
} |
149
|
0
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
|
=head2 new |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
Generates an order for the desired MX package. |
153
|
|
|
|
|
|
|
DEPRECATED |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=over |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * Parameter: $domain - target domain for MX package, $offer - MX offer, $duration - allowed duration |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * Return: L<ARRAY> |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * Synopsis: $ovh->order->email->domain->new('mydomain.de', '100', $allowed_durations->[0]); |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=back |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=cut |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
my ($self, $domain, $offer, $duration) = @_; |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
croak "Missing offer" unless $offer; |
171
|
|
|
|
|
|
|
croak "Missing duration" unless $duration; |
172
|
|
|
|
|
|
|
croak "Missing domain" unless $domain; |
173
|
|
|
|
|
|
|
|
174
|
0
|
|
|
0
|
1
|
|
my $api = $self->{_api_wrapper}; |
175
|
|
|
|
|
|
|
my $module = $self->{_module}; |
176
|
0
|
0
|
|
|
|
|
my $body = { offer => $offer, domain => $domain }; |
177
|
0
|
0
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/order/email/domain/new/$duration", body => $body, noSignature => 0 ); |
178
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
my $order = $module->me->order($response->content->{orderId}); |
181
|
0
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
return $order; |
183
|
0
|
|
|
|
|
|
} |
184
|
0
|
0
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
1; |