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