line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Webservice::OVH::Order::Hosting::Web; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=encoding utf-8 |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Webservice::OVH::Order::Hosting::Web |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Webservice::OVH; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $ovh = Webservice::OVH->new_from_json("credentials.json"); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $free_email_info = $ovh->order->hosting->web->free_email_info; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Provides the possibility to activate the free hostig package. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 METHODS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
36
|
|
|
36
|
|
250
|
use strict; |
|
36
|
|
|
|
|
90
|
|
|
36
|
|
|
|
|
1032
|
|
26
|
36
|
|
|
36
|
|
194
|
use warnings; |
|
36
|
|
|
|
|
95
|
|
|
36
|
|
|
|
|
959
|
|
27
|
36
|
|
|
36
|
|
206
|
use Carp qw{ carp croak }; |
|
36
|
|
|
|
|
78
|
|
|
36
|
|
|
|
|
20409
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $VERSION = 0.48; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head2 _new |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Internal Method to create the Web object. |
34
|
|
|
|
|
|
|
This method is not ment to be called directly. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=item * Return: L<Webservice::OVH::Order::Hosting::Web> |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order::Hosting::Web->_new($ovh_api_wrapper, $module); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=back |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _new { |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
|
|
my ( $class, %params ) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
die "Missing module" unless $params{module}; |
53
|
0
|
0
|
|
|
|
|
die "Missing wrapper" unless $params{wrapper}; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $module = $params{module}; |
56
|
0
|
|
|
|
|
|
my $api_wrapper = $params{wrapper}; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $self = bless { _module => $module, _api_wrapper => $api_wrapper }, $class; |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $self; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 free_email_info |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Gets information if free webhosting is available. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * Parameter: $domain - target domain for free webhosting |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * Return: HASH |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * Synopsis: Webservice::OVH::Order::Hosting::Web->_new('mydomain.de'); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub free_email_info { |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
1
|
|
my ( $self, $domain ) = @_; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
croak "Missing domain" unless $domain; |
84
|
0
|
|
|
|
|
|
my $offer = "START"; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "domain" => $domain, "offer" => $offer ); |
87
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
88
|
0
|
|
|
|
|
|
my $response_duration = $api->rawCall( method => 'get', path => "/order/hosting/web/new$filter", noSignature => 0 ); |
89
|
0
|
0
|
|
|
|
|
croak $response_duration->error if $response_duration->error; |
90
|
0
|
|
|
|
|
|
my $duration = $response_duration->content->[0]; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my $filter2 = Webservice::OVH::Helper->construct_filter( "domain" => $domain, "offer" => $offer ); |
93
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'get', path => sprintf( "/order/hosting/web/new/%s%s", $duration, $filter2 ), noSignature => 0 ); |
94
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return $response->content; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 activate_free_email |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Generates an order and pays the order for free webhosting. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * Parameter: $domain - target domain for free webhosting, $params - zusätzliche Parameter beim hosting erlauben |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * Return: L<Webservice::Me::Order> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * Synopsis: my $order = Webservice::OVH::Order::Hosting::Web->activate_free_email('mydomain.de'); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=back |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub activate_free_email { |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
0
|
1
|
|
my ( $self, $domain, $params ) = @_; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
my $module = $self->{_module}; |
120
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
croak "Missing domain" unless $domain; |
122
|
0
|
|
|
|
|
|
my $offer = 'START'; |
123
|
0
|
|
|
|
|
|
my $dns_zone = 'NO_CHANGE'; |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
my $filter = Webservice::OVH::Helper->construct_filter( "domain" => $domain, "offer" => $offer ); |
126
|
0
|
|
|
|
|
|
my $api = $self->{_api_wrapper}; |
127
|
0
|
|
|
|
|
|
my $response_duration = $api->rawCall( method => 'get', path => sprintf( "/order/hosting/web/new%s", $filter ), noSignature => 0 ); |
128
|
0
|
0
|
|
|
|
|
croak $response_duration->error if $response_duration->error; |
129
|
0
|
|
|
|
|
|
my $duration = $response_duration->content->[0]; |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $body = { domain => $domain, offer => 'START', dnsZone => $dns_zone, %$params }; |
132
|
0
|
|
|
|
|
|
my $response = $api->rawCall( method => 'post', path => "/order/hosting/web/new/$duration", body => $body, noSignature => 0 ); |
133
|
0
|
0
|
|
|
|
|
croak $response->error if $response->error; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
my $order = $module->me->order( $response->content->{orderId} ); |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
$order->pay_with_registered_payment_mean('fidelityAccount'); |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return $order; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |