| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | =encoding utf-8 | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | =head1 NAME | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | Webservice::OVH::Me::Bill | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | use Webservice::OVH; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | my $ovh = Webservice::OVH->new_from_json("credentials.json"); | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | my $bills = $ovh->me->bills; | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | foreach my $bill (@$bills) { | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | print $contact->url; | 
| 19 |  |  |  |  |  |  | } | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | Propvides access to contact properties. | 
| 24 |  |  |  |  |  |  | No managing methods are available at the moment. | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | =head1 METHODS | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =cut | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | use strict; | 
| 31 | 36 |  |  | 36 |  | 228 | use warnings; | 
|  | 36 |  |  |  |  | 65 |  | 
|  | 36 |  |  |  |  | 936 |  | 
| 32 | 36 |  |  | 36 |  | 159 | use Carp qw{ carp croak }; | 
|  | 36 |  |  |  |  | 71 |  | 
|  | 36 |  |  |  |  | 914 |  | 
| 33 | 36 |  |  | 36 |  | 172 |  | 
|  | 36 |  |  |  |  | 59 |  | 
|  | 36 |  |  |  |  | 2232 |  | 
| 34 |  |  |  |  |  |  | our $VERSION = 0.47; | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | use Webservice::OVH::Me::Order; | 
| 37 | 36 |  |  | 36 |  | 228 |  | 
|  | 36 |  |  |  |  | 117 |  | 
|  | 36 |  |  |  |  | 20246 |  | 
| 38 |  |  |  |  |  |  | =head2 _new | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Internal Method to create the Bill 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, $bill_id - api id | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =item * Return: L<Webservice::OVH::Me::Bill> | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =item * Synopsis: Webservice::OVH::Me::Bill->_new($ovh_api_wrapper, $bill_id, $module); | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | =back | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =cut | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | my ( $class, %params ) = @_; | 
| 57 |  |  |  |  |  |  |  | 
| 58 | 0 |  |  | 0 |  |  | die "Missing module"    unless $params{module}; | 
| 59 |  |  |  |  |  |  | die "Missing wrapper"   unless $params{wrapper}; | 
| 60 | 0 | 0 |  |  |  |  | die "Missing id"        unless $params{id}; | 
| 61 | 0 | 0 |  |  |  |  |  | 
| 62 | 0 | 0 |  |  |  |  | my $module      = $params{module}; | 
| 63 |  |  |  |  |  |  | my $api_wrapper = $params{wrapper}; | 
| 64 | 0 |  |  |  |  |  | my $bill_id     = $params{id}; | 
| 65 | 0 |  |  |  |  |  |  | 
| 66 | 0 |  |  |  |  |  | my $response = $api_wrapper->rawCall( method => 'get', path => "/me/bill/$bill_id", noSignature => 0 ); | 
| 67 |  |  |  |  |  |  | croak $response->error if $response->error; | 
| 68 | 0 |  |  |  |  |  |  | 
| 69 | 0 | 0 |  |  |  |  | my $porperties = $response->content; | 
| 70 |  |  |  |  |  |  | my $order_id   = $porperties->{orderId}; | 
| 71 | 0 |  |  |  |  |  |  | 
| 72 | 0 |  |  |  |  |  | my $self = bless { _module => $module, _api_wrapper => $api_wrapper, _id => $bill_id, _properties => $porperties, _order_id => $order_id }, $class; | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 0 |  |  |  |  |  | return $self; | 
| 75 |  |  |  |  |  |  | } | 
| 76 | 0 |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =head2 id | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | Returns the api id. | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | =over | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =item * Return: VALUE | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =item * Synopsis: my $id = $bill->id; | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =back | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =cut | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | my ($self) = @_; | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | return $self->{_id}; | 
| 95 | 0 |  |  | 0 | 1 |  | } | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 0 |  |  |  |  |  | =head2 order | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | Returns associated order. | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =over | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =item * Return: L<Webservice::Me::Order> | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =item * Synopsis: my $order = $bill->order; | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =back | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =cut | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | my ( $self, $module ) = @_; | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | my $api = $self->{_api_wrapper}; | 
| 115 |  |  |  |  |  |  |  | 
| 116 | 0 |  |  | 0 | 1 |  | my $order_id = $self->{_order_id}; | 
| 117 |  |  |  |  |  |  | my $order    = $module->me->order($order_id); | 
| 118 | 0 |  |  |  |  |  | return $order; | 
| 119 |  |  |  |  |  |  |  | 
| 120 | 0 |  |  |  |  |  | } | 
| 121 | 0 |  |  |  |  |  |  | 
| 122 | 0 |  |  |  |  |  | =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 = $bill->properties; | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =back | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =cut | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | my ($self) = @_; | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | my $api      = $self->{_api_wrapper}; | 
| 141 |  |  |  |  |  |  | my $bill_id  = $self->id; | 
| 142 |  |  |  |  |  |  | my $response = $api->rawCall( method => 'get', path => "/me/bill/$bill_id", noSignature => 0 ); | 
| 143 | 0 |  |  | 0 | 1 |  | croak $response->error if $response->error; | 
| 144 |  |  |  |  |  |  |  | 
| 145 | 0 |  |  |  |  |  | $self->{_properties} = $response->content; | 
| 146 | 0 |  |  |  |  |  | return $self->{_properties}; | 
| 147 | 0 |  |  |  |  |  | } | 
| 148 | 0 | 0 |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | =head2 date | 
| 150 | 0 |  |  |  |  |  |  | 
| 151 | 0 |  |  |  |  |  | Exposed property value. | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | =over | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =item * Return: DateTime | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =item * Synopsis: my $date = $bill->date; | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | =back | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | =cut | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | my ($self) = @_; | 
| 165 |  |  |  |  |  |  |  | 
| 166 |  |  |  |  |  |  | my $str_datetime = $self->{_properties}->{date}; | 
| 167 |  |  |  |  |  |  | my $datetime     = Webservice::OVH::Helper->parse_datetime($str_datetime); | 
| 168 |  |  |  |  |  |  | return $datetime; | 
| 169 |  |  |  |  |  |  | } | 
| 170 | 0 |  |  | 0 | 1 |  |  | 
| 171 |  |  |  |  |  |  | =head2 password | 
| 172 | 0 |  |  |  |  |  |  | 
| 173 | 0 |  |  |  |  |  | Exposed property value. | 
| 174 | 0 |  |  |  |  |  |  | 
| 175 |  |  |  |  |  |  | =over | 
| 176 |  |  |  |  |  |  |  | 
| 177 |  |  |  |  |  |  | =item * Return: VALUE | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | =item * Synopsis: my $password = $bill->password; | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | =back | 
| 182 |  |  |  |  |  |  |  | 
| 183 |  |  |  |  |  |  | =cut | 
| 184 |  |  |  |  |  |  |  | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | my ($self) = @_; | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | return $self->{_properties}->{password}; | 
| 189 |  |  |  |  |  |  | } | 
| 190 |  |  |  |  |  |  |  | 
| 191 |  |  |  |  |  |  | =head2 pdf_url | 
| 192 |  |  |  |  |  |  |  | 
| 193 | 0 |  |  | 0 | 1 |  | Exposed property value. | 
| 194 |  |  |  |  |  |  |  | 
| 195 | 0 |  |  |  |  |  | =over | 
| 196 |  |  |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | =item * Return: VALUE | 
| 198 |  |  |  |  |  |  |  | 
| 199 |  |  |  |  |  |  | =item * Synopsis: my $pdf_url = $bill->pdf_url; | 
| 200 |  |  |  |  |  |  |  | 
| 201 |  |  |  |  |  |  | =back | 
| 202 |  |  |  |  |  |  |  | 
| 203 |  |  |  |  |  |  | =cut | 
| 204 |  |  |  |  |  |  |  | 
| 205 |  |  |  |  |  |  |  | 
| 206 |  |  |  |  |  |  | my ($self) = @_; | 
| 207 |  |  |  |  |  |  |  | 
| 208 |  |  |  |  |  |  | return $self->{_properties}->{pdfUrl}; | 
| 209 |  |  |  |  |  |  | } | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | =head2 price_without_tax | 
| 212 |  |  |  |  |  |  |  | 
| 213 |  |  |  |  |  |  | Exposed property value. | 
| 214 | 0 |  |  | 0 | 1 |  |  | 
| 215 |  |  |  |  |  |  | =over | 
| 216 | 0 |  |  |  |  |  |  | 
| 217 |  |  |  |  |  |  | =item * Return: VALUE | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | =item * Synopsis: my $price_without_tax = $bill->price_without_tax; | 
| 220 |  |  |  |  |  |  |  | 
| 221 |  |  |  |  |  |  | =back | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | =cut | 
| 224 |  |  |  |  |  |  |  | 
| 225 |  |  |  |  |  |  |  | 
| 226 |  |  |  |  |  |  | my ($self) = @_; | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | return $self->{_properties}->{priceWithoutTax}; | 
| 229 |  |  |  |  |  |  | } | 
| 230 |  |  |  |  |  |  |  | 
| 231 |  |  |  |  |  |  | =head2 price_with_tax | 
| 232 |  |  |  |  |  |  |  | 
| 233 |  |  |  |  |  |  | Exposed property value. | 
| 234 |  |  |  |  |  |  |  | 
| 235 | 0 |  |  | 0 | 1 |  | =over | 
| 236 |  |  |  |  |  |  |  | 
| 237 | 0 |  |  |  |  |  | =item * Return: VALUE | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | =item * Synopsis: my $price_with_tax = $bill->price_with_tax; | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | =back | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | =cut | 
| 244 |  |  |  |  |  |  |  | 
| 245 |  |  |  |  |  |  |  | 
| 246 |  |  |  |  |  |  | my ($self) = @_; | 
| 247 |  |  |  |  |  |  |  | 
| 248 |  |  |  |  |  |  | return $self->{_properties}->{priceWithTax}; | 
| 249 |  |  |  |  |  |  | } | 
| 250 |  |  |  |  |  |  |  | 
| 251 |  |  |  |  |  |  | =head2 tax | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | Exposed property value. | 
| 254 |  |  |  |  |  |  |  | 
| 255 |  |  |  |  |  |  | =over | 
| 256 | 0 |  |  | 0 | 1 |  |  | 
| 257 |  |  |  |  |  |  | =item * Return: VALUE | 
| 258 | 0 |  |  |  |  |  |  | 
| 259 |  |  |  |  |  |  | =item * Synopsis: my $tax = $bill->tax; | 
| 260 |  |  |  |  |  |  |  | 
| 261 |  |  |  |  |  |  | =back | 
| 262 |  |  |  |  |  |  |  | 
| 263 |  |  |  |  |  |  | =cut | 
| 264 |  |  |  |  |  |  |  | 
| 265 |  |  |  |  |  |  |  | 
| 266 |  |  |  |  |  |  | my ($self) = @_; | 
| 267 |  |  |  |  |  |  |  | 
| 268 |  |  |  |  |  |  | return $self->{_properties}->{tax}; | 
| 269 |  |  |  |  |  |  | } | 
| 270 |  |  |  |  |  |  |  | 
| 271 |  |  |  |  |  |  | =head2 url | 
| 272 |  |  |  |  |  |  |  | 
| 273 |  |  |  |  |  |  | Exposed property value. | 
| 274 |  |  |  |  |  |  |  | 
| 275 |  |  |  |  |  |  | =over | 
| 276 |  |  |  |  |  |  |  | 
| 277 | 0 |  |  | 0 | 1 |  | =item * Return: VALUE | 
| 278 |  |  |  |  |  |  |  | 
| 279 | 0 |  |  |  |  |  | =item * Synopsis: my $url = $bill->url; | 
| 280 |  |  |  |  |  |  |  | 
| 281 |  |  |  |  |  |  | =back | 
| 282 |  |  |  |  |  |  |  | 
| 283 |  |  |  |  |  |  | =cut | 
| 284 |  |  |  |  |  |  |  | 
| 285 |  |  |  |  |  |  |  | 
| 286 |  |  |  |  |  |  | my ($self) = @_; | 
| 287 |  |  |  |  |  |  |  | 
| 288 |  |  |  |  |  |  | return $self->{_properties}->{url}; | 
| 289 |  |  |  |  |  |  | } | 
| 290 |  |  |  |  |  |  |  | 
| 291 |  |  |  |  |  |  | 1; |