| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Webservice::OVH::Me::Order::Detail; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =encoding utf-8 | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 NAME | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | Webservice::OVH::Me::Order::Details | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | use Webservice::OVH; | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | my $ovh = Webservice::OVH->new_from_json("credentials.json"); | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | my $order = $ovh->me->orders->[0]; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | my $details = $order->details; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | foreach my $detail (@$details) { | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | print $detail->unit_price; | 
| 22 |  |  |  |  |  |  | } | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | Provides access to details for an order entry. | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head1 METHODS | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =cut | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 36 |  |  | 36 |  | 274 | use strict; | 
|  | 36 |  |  |  |  | 81 |  | 
|  | 36 |  |  |  |  | 1005 |  | 
| 33 | 36 |  |  | 36 |  | 196 | use warnings; | 
|  | 36 |  |  |  |  | 76 |  | 
|  | 36 |  |  |  |  | 958 |  | 
| 34 | 36 |  |  | 36 |  | 226 | use Carp qw{ carp croak }; | 
|  | 36 |  |  |  |  | 122 |  | 
|  | 36 |  |  |  |  | 23092 |  | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | our $VERSION = 0.48; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =head2 _new | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Internal Method to create the Detail object. | 
| 41 |  |  |  |  |  |  | This method is not ment to be called directly. | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =over | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =item * Parameter: $api_wrapper - ovh api wrapper object, $module - root object, $detail_id - api id | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Me::Order::Detail> | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =item * Synopsis: Webservice::OVH::Me::Order::Detail->_new($ovh_api_wrapper, $detail_id, $module); | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =back | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =cut | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | sub _new { | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  | 0 |  |  | my ( $class, %params ) = @_; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 0 | 0 |  |  |  |  | die "Missing module"    unless $params{module}; | 
| 60 | 0 | 0 |  |  |  |  | die "Missing wrapper"   unless $params{wrapper}; | 
| 61 | 0 | 0 |  |  |  |  | die "Missing id"        unless $params{id}; | 
| 62 | 0 | 0 |  |  |  |  | die "Missing order"     unless $params{order}; | 
| 63 |  |  |  |  |  |  |  | 
| 64 | 0 |  |  |  |  |  | my $module      = $params{module}; | 
| 65 | 0 |  |  |  |  |  | my $api_wrapper = $params{wrapper}; | 
| 66 | 0 |  |  |  |  |  | my $detail_id     = $params{id}; | 
| 67 | 0 |  |  |  |  |  | my $order       = $params{order}; | 
| 68 | 0 |  |  |  |  |  | my $order_id = $order->id; | 
| 69 |  |  |  |  |  |  |  | 
| 70 | 0 |  |  |  |  |  | my $response = $api_wrapper->rawCall( method => 'get', path => "/me/order/$order_id/details/$detail_id", noSignature => 0 ); | 
| 71 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 72 |  |  |  |  |  |  |  | 
| 73 | 0 |  |  |  |  |  | my $porperties = $response->content; | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 0 |  |  |  |  |  | my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _id => $detail_id, _properties => $porperties, _order => $order }, $class; | 
| 76 |  |  |  |  |  |  |  | 
| 77 | 0 |  |  |  |  |  | return $self; | 
| 78 |  |  |  |  |  |  | } | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =head2 order | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | Returns root Order object. | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =over | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Me::Order> | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =item * Synopsis: my $order = $datail->order; | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =back | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | =cut | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | sub order { | 
| 95 |  |  |  |  |  |  |  | 
| 96 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 0 |  |  |  |  |  | return $self->{_order}; | 
| 99 |  |  |  |  |  |  | } | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head2 id | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | Returns the api id. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =over | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =item * Return: VALUE | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =item * Synopsis: my $id = $detail->id; | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =back | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =cut | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | sub id { | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 118 |  |  |  |  |  |  |  | 
| 119 | 0 |  |  |  |  |  | return $self->{_id}; | 
| 120 |  |  |  |  |  |  | } | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =head2 properties | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | Retrieves properties. | 
| 125 |  |  |  |  |  |  | This method updates the intern property variable. | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =over | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =item * Return: HASH | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =item * Synopsis: my $properties = $detail->properties; | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =back | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =cut | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | sub properties { | 
| 138 |  |  |  |  |  |  |  | 
| 139 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 140 |  |  |  |  |  |  |  | 
| 141 | 0 |  |  |  |  |  | my $api       = $self->{_api_wrapper}; | 
| 142 | 0 |  |  |  |  |  | my $order_id  = $self->{_order}->id; | 
| 143 | 0 |  |  |  |  |  | my $detail_id = $self->id; | 
| 144 | 0 |  |  |  |  |  | my $response  = $api->rawCall( method => 'get', path => "/me/order/$order_id/details/$detail_id", noSignature => 0 ); | 
| 145 | 0 | 0 |  |  |  |  | croak $response->error if $response->error; | 
| 146 |  |  |  |  |  |  |  | 
| 147 | 0 |  |  |  |  |  | $self->{_properties} = $response->content; | 
| 148 | 0 |  |  |  |  |  | return $self->{_properties}; | 
| 149 |  |  |  |  |  |  | } | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =head2 description | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | Exposed property value. | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =over | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =item * Return: VALUE | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =item * Synopsis: my $description = $detail->description; | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | =back | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | =cut | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | sub description { | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 168 |  |  |  |  |  |  |  | 
| 169 | 0 |  |  |  |  |  | return $self->{_properties}->{description}; | 
| 170 |  |  |  |  |  |  | } | 
| 171 |  |  |  |  |  |  |  | 
| 172 |  |  |  |  |  |  | =head2 domain | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | Exposed property value. | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | =over | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | =item * Return: VALUE | 
| 179 |  |  |  |  |  |  |  | 
| 180 |  |  |  |  |  |  | =item * Synopsis: my $domain = $detail->domain; | 
| 181 |  |  |  |  |  |  |  | 
| 182 |  |  |  |  |  |  | =back | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =cut | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | sub domain { | 
| 187 |  |  |  |  |  |  |  | 
| 188 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 189 |  |  |  |  |  |  |  | 
| 190 | 0 |  |  |  |  |  | return $self->{_properties}->{domain}; | 
| 191 |  |  |  |  |  |  | } | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | =head2 quantity | 
| 194 |  |  |  |  |  |  |  | 
| 195 |  |  |  |  |  |  | Exposed property value. | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | =over | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | =item * Return: VALUE | 
| 200 |  |  |  |  |  |  |  | 
| 201 |  |  |  |  |  |  | =item * Synopsis: my $quantity = $detail->quantity; | 
| 202 |  |  |  |  |  |  |  | 
| 203 |  |  |  |  |  |  | =back | 
| 204 |  |  |  |  |  |  |  | 
| 205 |  |  |  |  |  |  | =cut | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | sub quantity { | 
| 208 |  |  |  |  |  |  |  | 
| 209 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 210 |  |  |  |  |  |  |  | 
| 211 | 0 |  |  |  |  |  | return $self->{_properties}->{quantity}; | 
| 212 |  |  |  |  |  |  | } | 
| 213 |  |  |  |  |  |  |  | 
| 214 |  |  |  |  |  |  | =head2 total_price | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | Exposed property value. | 
| 217 |  |  |  |  |  |  |  | 
| 218 |  |  |  |  |  |  | =over | 
| 219 |  |  |  |  |  |  |  | 
| 220 |  |  |  |  |  |  | =item * Return: VALUE | 
| 221 |  |  |  |  |  |  |  | 
| 222 |  |  |  |  |  |  | =item * Synopsis: my $total_price = $detail->total_price; | 
| 223 |  |  |  |  |  |  |  | 
| 224 |  |  |  |  |  |  | =back | 
| 225 |  |  |  |  |  |  |  | 
| 226 |  |  |  |  |  |  | =cut | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | sub total_price { | 
| 229 |  |  |  |  |  |  |  | 
| 230 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 231 |  |  |  |  |  |  |  | 
| 232 | 0 |  |  |  |  |  | return $self->{_properties}->{totalPrice}; | 
| 233 |  |  |  |  |  |  | } | 
| 234 |  |  |  |  |  |  |  | 
| 235 |  |  |  |  |  |  | =head2 unit_price | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | Exposed property value. | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | =over | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | =item * Return: VALUE | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | =item * Synopsis: my $unit_price = $detail->unit_price; | 
| 244 |  |  |  |  |  |  |  | 
| 245 |  |  |  |  |  |  | =back | 
| 246 |  |  |  |  |  |  |  | 
| 247 |  |  |  |  |  |  | =cut | 
| 248 |  |  |  |  |  |  |  | 
| 249 |  |  |  |  |  |  | sub unit_price { | 
| 250 |  |  |  |  |  |  |  | 
| 251 | 0 |  |  | 0 | 1 |  | my ($self) = @_; | 
| 252 |  |  |  |  |  |  |  | 
| 253 | 0 |  |  |  |  |  | return $self->{_properties}->{unitPrice}; | 
| 254 |  |  |  |  |  |  | } | 
| 255 |  |  |  |  |  |  |  | 
| 256 |  |  |  |  |  |  | 1; |