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