Hide Show 12 lines of Pod
require
5.6.0;
__PACKAGE__->mk_classdata(
'method_documentation'
=> {});
sub
new {
my
$class
=
shift
;
my
$api_client
;
if
(
$_
[0] &&
ref
$_
[0] &&
ref
$_
[0] eq
'WebService::Fastly::ApiClient'
) {
$api_client
=
$_
[0];
}
else
{
$api_client
= WebService::Fastly::ApiClient->new(
@_
);
}
bless
{
api_client
=>
$api_client
},
$class
;
}
{
my
$params
= {
'month'
=> {
data_type
=>
'string'
,
description
=>
'2-digit month.'
,
required
=>
'1'
,
},
'year'
=> {
data_type
=>
'string'
,
description
=>
'4-digit year.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'get_invoice'
} = {
summary
=>
'Get an invoice'
,
params
=>
$params
,
returns
=>
'BillingResponse'
,
};
}
sub
get_invoice {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'month'
}) {
croak(
"Missing the required parameter 'month' when calling get_invoice"
);
}
unless
(
exists
$args
{
'year'
}) {
croak(
"Missing the required parameter 'year' when calling get_invoice"
);
}
my
$_resource_path
=
'/billing/v2/year/{year}/month/{month}'
;
my
$_method
=
'GET'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
,
'text/csv'
,
'application/pdf'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'month'
}) {
my
$_base_variable
=
"{"
.
"month"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'month'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'year'
}) {
my
$_base_variable
=
"{"
.
"year"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'year'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'BillingResponse'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'customer_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the customer.'
,
required
=>
'1'
,
},
'invoice_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the invoice.'
,
required
=>
'1'
,
},
};
__PACKAGE__->method_documentation->{
'get_invoice_by_id'
} = {
summary
=>
'Get an invoice'
,
params
=>
$params
,
returns
=>
'BillingResponse'
,
};
}
sub
get_invoice_by_id {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'customer_id'
}) {
croak(
"Missing the required parameter 'customer_id' when calling get_invoice_by_id"
);
}
unless
(
exists
$args
{
'invoice_id'
}) {
croak(
"Missing the required parameter 'invoice_id' when calling get_invoice_by_id"
);
}
my
$_resource_path
=
'/billing/v2/account_customers/{customer_id}/invoices/{invoice_id}'
;
my
$_method
=
'GET'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
,
'text/csv'
,
'application/pdf'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'customer_id'
}) {
my
$_base_variable
=
"{"
.
"customer_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'customer_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
if
(
exists
$args
{
'invoice_id'
}) {
my
$_base_variable
=
"{"
.
"invoice_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'invoice_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'BillingResponse'
,
$response
);
return
$_response_object
;
}
{
my
$params
= {
'customer_id'
=> {
data_type
=>
'string'
,
description
=>
'Alphanumeric string identifying the customer.'
,
required
=>
'1'
,
},
'month'
=> {
data_type
=>
'string'
,
description
=>
'2-digit month.'
,
required
=>
'0'
,
},
'year'
=> {
data_type
=>
'string'
,
description
=>
'4-digit year.'
,
required
=>
'0'
,
},
};
__PACKAGE__->method_documentation->{
'get_invoice_mtd'
} = {
summary
=>
'Get month-to-date billing estimate'
,
params
=>
$params
,
returns
=>
'BillingEstimateResponse'
,
};
}
sub
get_invoice_mtd {
my
(
$self
,
%args
) =
@_
;
unless
(
exists
$args
{
'customer_id'
}) {
croak(
"Missing the required parameter 'customer_id' when calling get_invoice_mtd"
);
}
my
$_resource_path
=
'/billing/v2/account_customers/{customer_id}/mtd_invoice'
;
my
$_method
=
'GET'
;
my
$query_params
= {};
my
$header_params
= {};
my
$form_params
= {};
my
$_header_accept
=
$self
->{api_client}->select_header_accept(
'application/json'
);
if
(
$_header_accept
) {
$header_params
->{
'Accept'
} =
$_header_accept
;
}
$header_params
->{
'Content-Type'
} =
$self
->{api_client}->select_header_content_type();
if
(
exists
$args
{
'month'
}) {
$query_params
->{
'month'
} =
$self
->{api_client}->to_query_value(
$args
{
'month'
});
}
if
(
exists
$args
{
'year'
}) {
$query_params
->{
'year'
} =
$self
->{api_client}->to_query_value(
$args
{
'year'
});
}
if
(
exists
$args
{
'customer_id'
}) {
my
$_base_variable
=
"{"
.
"customer_id"
.
"}"
;
my
$_base_value
=
$self
->{api_client}->to_path_value(
$args
{
'customer_id'
});
$_resource_path
=~ s/
$_base_variable
/
$_base_value
/g;
}
my
$_body_data
;
my
$auth_settings
= [
qw(token )
];
my
$response
=
$self
->{api_client}->call_api(
$_resource_path
,
$_method
,
$query_params
,
$form_params
,
$header_params
,
$_body_data
,
$auth_settings
);
if
(!
$response
) {
return
;
}
my
$_response_object
=
$self
->{api_client}->deserialize(
'BillingEstimateResponse'
,
$response
);
return
$_response_object
;
}
1;