| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Webservice::OVH::Order::Domain::Zone; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =encoding utf-8 | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | Webservice::OVH::Order::Domain::Zone | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | use Webservice::OVH; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | my $ovh = Webservice::OVH->new_from_json("credentials.json"); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | my $existing_zones = $ovh->order->domain->zone->existing; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | Provides the possibility to order domain zones only. | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head1 METHODS | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | =cut | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 36 |  |  | 36 |  | 257 | use strict; | 
|  | 36 |  |  |  |  | 85 |  | 
|  | 36 |  |  |  |  | 1040 |  | 
| 26 | 36 |  |  | 36 |  | 193 | use warnings; | 
|  | 36 |  |  |  |  | 79 |  | 
|  | 36 |  |  |  |  | 1016 |  | 
| 27 | 36 |  |  | 36 |  | 230 | use Carp qw{ carp croak }; | 
|  | 36 |  |  |  |  | 93 |  | 
|  | 36 |  |  |  |  | 2629 |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | our $VERSION = 0.48; | 
| 30 |  |  |  |  |  |  |  | 
| 31 | 36 |  |  | 36 |  | 264 | use Webservice::OVH::Me::Order; | 
|  | 36 |  |  |  |  | 106 |  | 
|  | 36 |  |  |  |  | 17387 |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head2 _new | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | Internal Method to create the Zone object. | 
| 36 |  |  |  |  |  |  | This method is not ment to be called directly. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =over | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Order::Domain::Zone> | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =item * Synopsis: Webservice::OVH::Order::Domain::Zone->_new($ovh_api_wrapper, $module); | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =back | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =cut | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | sub _new { | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 0 |  |  | 0 |  |  | my ( $class, %params ) = @_; | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 | 0 |  |  |  |  | die "Missing module"  unless $params{module}; | 
| 55 | 0 | 0 |  |  |  |  | die "Missing wrapper" unless $params{wrapper}; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  |  |  |  | my $module      = $params{module}; | 
| 58 | 0 |  |  |  |  |  | my $api_wrapper = $params{wrapper}; | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 |  |  |  |  |  | my $self = bless { _module => $module, _api_wrapper => $api_wrapper }, $class; | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 |  |  |  |  |  | return $self; | 
| 63 |  |  |  |  |  |  | } | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =head2 _new | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | Returns an array with all available zones connected to the active account. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =over | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =item * Return: L<ARRAY> | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =item * Synopsis: my $existing_zones = $ovh->order->domain->zone->existing; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =back | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =cut | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | sub existing { | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 82 |  |  |  |  |  |  |  | 
| 83 | 0 |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 84 |  |  |  |  |  |  |  | 
| 85 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/order/domain/zone", noSignature => 0 ); | 
| 86 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 87 |  |  |  |  |  |  |  | 
| 88 | 0 |  |  |  |  |  | return $response->content; | 
| 89 |  |  |  |  |  |  | } | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =head2 _new | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | Gets information about a requested zone order. | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =over | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =item * Return: HASH | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | =item * Synopsis: my $existing_zones = $ovh->order->domain->zone->existing; | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =back | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =cut | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | sub info_order { | 
| 106 |  |  |  |  |  |  |  | 
| 107 | 0 |  |  | 0 | 0 |  | my ($self) = @_; | 
| 108 |  |  |  |  |  |  |  | 
| 109 | 0 |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 110 |  |  |  |  |  |  |  | 
| 111 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/order/domain/zone/new", noSignature => 0 ); | 
| 112 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 113 |  |  |  |  |  |  |  | 
| 114 | 0 |  |  |  |  |  | return $response->content; | 
| 115 |  |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =head2 _new | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | Gets information about a requested zone order. | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =over | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | =item * Parameter: $zone_name - desired zone, $minimized - only mandatory record entries | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Me::Order> | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =item * Synopsis: my $oder = $ovh->order->domain->zone->order('mydomain.de', 'true'); | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =back | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =cut | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | sub order { | 
| 134 |  |  |  |  |  |  |  | 
| 135 | 0 |  |  | 0 | 1 |  | my ( $self, $zone_name, $minimized ) = @_; | 
| 136 |  |  |  |  |  |  |  | 
| 137 | 0 |  | 0 |  |  |  | $minimized ||= 'false'; | 
| 138 |  |  |  |  |  |  |  | 
| 139 | 0 |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 140 | 0 |  |  |  |  |  | my $module = $self->{_module}; | 
| 141 |  |  |  |  |  |  |  | 
| 142 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'post', path => "/order/domain/zone/new", body => { zoneName => $zone_name, minimized => $minimized }, noSignature => 0 ); | 
| 143 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 144 |  |  |  |  |  |  |  | 
| 145 | 0 |  |  |  |  |  | my $order = $module->me->order( $response->content->{orderId} ); | 
| 146 |  |  |  |  |  |  |  | 
| 147 | 0 |  |  |  |  |  | return $order; | 
| 148 |  |  |  |  |  |  | } | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =head2 _new | 
| 151 |  |  |  |  |  |  |  | 
| 152 |  |  |  |  |  |  | Gets available options for the desired zone order. | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | =over | 
| 155 |  |  |  |  |  |  |  | 
| 156 |  |  |  |  |  |  | =item * Parameter: $zone_name - desired zone | 
| 157 |  |  |  |  |  |  |  | 
| 158 |  |  |  |  |  |  | =item * Return: HASH | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | =item * Synopsis: my $options = $ovh->order->domain->zone->options('mydomain.de'); | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =back | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | =cut | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | sub options { | 
| 167 |  |  |  |  |  |  |  | 
| 168 | 0 |  |  | 0 | 1 |  | my ( $self, $zone_name ) = @_; | 
| 169 |  |  |  |  |  |  |  | 
| 170 | 0 |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 171 |  |  |  |  |  |  |  | 
| 172 | 0 |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/order/domain/zone/$zone_name", noSignature => 0 ); | 
| 173 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 174 |  |  |  |  |  |  |  | 
| 175 | 0 |  |  |  |  |  | return $response->content; | 
| 176 |  |  |  |  |  |  | } | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | 1; |