Fastly/BillingAddressApi.pm untested

filter: Statementstmt 0.0% 0 / 147 Branchbran 0.0% 0 / 36 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 211 CC 19 SCAR 31.7
CC
19
Cov
0%
add_billing_addr
42.0
update_billing_addr
42.0
get_billing_addr
30.0
CRAP 23.9
1 =begin comment
2  
3 Fastly API
4  
5 Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
6  
7 The version of the API Spec document: 1.0.0
8 Contact: oss@fastly.com
9  
10 =end comment
11  
12 =cut
13  
14 #
15 # NOTE: This class is auto generated.
16 # Do not edit the class manually.
17 #
18 package WebService::Fastly::BillingAddressApi;
19  
20 require 5.6.0;
21 use strict;
22 use warnings;
23 use utf8;
24 use Exporter;
25 use Carp qw( croak );
26 use Log::Any qw($log);
27  
28 use WebService::Fastly::ApiClient;
29  
30 use base "Class::Data::Inheritable";
31  
32 __PACKAGE__->mk_classdata('method_documentation' => {});
33  
34 sub new {
35 my $class = shift;
36 my $api_client;
37  
38 if ($_[0] && ref $_[0] && ref $_[0] eq 'WebService::Fastly::ApiClient' ) {
39 $api_client = $_[0];
40 } else {
41 $api_client = WebService::Fastly::ApiClient->new(@_);
42 }
43  
44 bless { api_client => $api_client }, $class;
45  
46 }
47  
48  
49 #
50 # add_billing_addr
51 #
52 # Add a billing address to a customer
53 #
54 # @param string $customer_id Alphanumeric string identifying the customer. (required)
55 # @param BillingAddressRequest $billing_address_request Billing address (optional)
56 {
57 my $params = {
58 'customer_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying the customer.',
61 required => '1',
62 },
63 'billing_address_request' => {
64 data_type => 'BillingAddressRequest',
65 description => 'Billing address',
66 required => '0',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'add_billing_addr' } = {
70 summary => 'Add a billing address to a customer',
71 params => $params,
72 returns => 'BillingAddressResponse',
73 };
74 }
75 # @return BillingAddressResponse
76 #
77 sub add_billing_addr {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'customer_id' is set
81 unless (exists $args{'customer_id'}) {
82 croak("Missing the required parameter 'customer_id' when calling add_billing_addr");
83 }
84  
85 # parse inputs
86 my $_resource_path = '/customer/{customer_id}/billing_address';
87  
88 my $_method = 'POST';
89 my $query_params = {};
90 my $header_params = {};
91 my $form_params = {};
92  
93 # 'Accept' and 'Content-Type' header
94 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
95 if ($_header_accept) {
96 $header_params->{'Accept'} = $_header_accept;
97 }
98 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json');
99  
100 # path params
101 if ( exists $args{'customer_id'}) {
102 my $_base_variable = "{" . "customer_id" . "}";
103 my $_base_value = $self->{api_client}->to_path_value($args{'customer_id'});
104 $_resource_path =~ s/$_base_variable/$_base_value/g;
105 }
106  
107 my $_body_data;
108 # body params
109 if ( exists $args{'billing_address_request'}) {
110 $_body_data = $args{'billing_address_request'};
111 }
112  
113 # authentication setting, if any
114 my $auth_settings = [qw(token )];
115  
116 # make the API Call
117 my $response = $self->{api_client}->call_api($_resource_path, $_method,
118 $query_params, $form_params,
119 $header_params, $_body_data, $auth_settings);
120 if (!$response) {
121 return;
122 }
123 my $_response_object = $self->{api_client}->deserialize('BillingAddressResponse', $response);
124 return $_response_object;
125 }
126  
127 #
128 # delete_billing_addr
129 #
130 # Delete a billing address
131 #
132 # @param string $customer_id Alphanumeric string identifying the customer. (required)
133 {
134 my $params = {
135 'customer_id' => {
136 data_type => 'string',
137 description => 'Alphanumeric string identifying the customer.',
138 required => '1',
139 },
140 };
141 __PACKAGE__->method_documentation->{ 'delete_billing_addr' } = {
142 summary => 'Delete a billing address',
143 params => $params,
144 returns => undef,
145 };
146 }
147 # @return void
148 #
149 sub delete_billing_addr {
150 my ($self, %args) = @_;
151  
152 # verify the required parameter 'customer_id' is set
153 unless (exists $args{'customer_id'}) {
154 croak("Missing the required parameter 'customer_id' when calling delete_billing_addr");
155 }
156  
157 # parse inputs
158 my $_resource_path = '/customer/{customer_id}/billing_address';
159  
160 my $_method = 'DELETE';
161 my $query_params = {};
162 my $header_params = {};
163 my $form_params = {};
164  
165 # 'Accept' and 'Content-Type' header
166 my $_header_accept = $self->{api_client}->select_header_accept();
167 if ($_header_accept) {
168 $header_params->{'Accept'} = $_header_accept;
169 }
170 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
171  
172 # path params
173 if ( exists $args{'customer_id'}) {
174 my $_base_variable = "{" . "customer_id" . "}";
175 my $_base_value = $self->{api_client}->to_path_value($args{'customer_id'});
176 $_resource_path =~ s/$_base_variable/$_base_value/g;
177 }
178  
179 my $_body_data;
180 # authentication setting, if any
181 my $auth_settings = [qw(token )];
182  
183 # make the API Call
184 $self->{api_client}->call_api($_resource_path, $_method,
185 $query_params, $form_params,
186 $header_params, $_body_data, $auth_settings);
187 return;
188 }
189  
190 #
191 # get_billing_addr
192 #
193 # Get a billing address
194 #
195 # @param string $customer_id Alphanumeric string identifying the customer. (required)
196 {
197 my $params = {
198 'customer_id' => {
199 data_type => 'string',
200 description => 'Alphanumeric string identifying the customer.',
201 required => '1',
202 },
203 };
204 __PACKAGE__->method_documentation->{ 'get_billing_addr' } = {
205 summary => 'Get a billing address',
206 params => $params,
207 returns => 'BillingAddressResponse',
208 };
209 }
210 # @return BillingAddressResponse
211 #
212 sub get_billing_addr {
213 my ($self, %args) = @_;
214  
215 # verify the required parameter 'customer_id' is set
216 unless (exists $args{'customer_id'}) {
217 croak("Missing the required parameter 'customer_id' when calling get_billing_addr");
218 }
219  
220 # parse inputs
221 my $_resource_path = '/customer/{customer_id}/billing_address';
222  
223 my $_method = 'GET';
224 my $query_params = {};
225 my $header_params = {};
226 my $form_params = {};
227  
228 # 'Accept' and 'Content-Type' header
229 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
230 if ($_header_accept) {
231 $header_params->{'Accept'} = $_header_accept;
232 }
233 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
234  
235 # path params
236 if ( exists $args{'customer_id'}) {
237 my $_base_variable = "{" . "customer_id" . "}";
238 my $_base_value = $self->{api_client}->to_path_value($args{'customer_id'});
239 $_resource_path =~ s/$_base_variable/$_base_value/g;
240 }
241  
242 my $_body_data;
243 # authentication setting, if any
244 my $auth_settings = [qw(token )];
245  
246 # make the API Call
247 my $response = $self->{api_client}->call_api($_resource_path, $_method,
248 $query_params, $form_params,
249 $header_params, $_body_data, $auth_settings);
250 if (!$response) {
251 return;
252 }
253 my $_response_object = $self->{api_client}->deserialize('BillingAddressResponse', $response);
254 return $_response_object;
255 }
256  
257 #
258 # update_billing_addr
259 #
260 # Update a billing address
261 #
262 # @param string $customer_id Alphanumeric string identifying the customer. (required)
263 # @param UpdateBillingAddressRequest $update_billing_address_request One or more billing address attributes (optional)
264 {
265 my $params = {
266 'customer_id' => {
267 data_type => 'string',
268 description => 'Alphanumeric string identifying the customer.',
269 required => '1',
270 },
271 'update_billing_address_request' => {
272 data_type => 'UpdateBillingAddressRequest',
273 description => 'One or more billing address attributes',
274 required => '0',
275 },
276 };
277 __PACKAGE__->method_documentation->{ 'update_billing_addr' } = {
278 summary => 'Update a billing address',
279 params => $params,
280 returns => 'BillingAddressResponse',
281 };
282 }
283 # @return BillingAddressResponse
284 #
285 sub update_billing_addr {
286 my ($self, %args) = @_;
287  
288 # verify the required parameter 'customer_id' is set
289 unless (exists $args{'customer_id'}) {
290 croak("Missing the required parameter 'customer_id' when calling update_billing_addr");
291 }
292  
293 # parse inputs
294 my $_resource_path = '/customer/{customer_id}/billing_address';
295  
296 my $_method = 'PATCH';
297 my $query_params = {};
298 my $header_params = {};
299 my $form_params = {};
300  
301 # 'Accept' and 'Content-Type' header
302 my $_header_accept = $self->{api_client}->select_header_accept('application/vnd.api+json');
303 if ($_header_accept) {
304 $header_params->{'Accept'} = $_header_accept;
305 }
306 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/vnd.api+json');
307  
308 # path params
309 if ( exists $args{'customer_id'}) {
310 my $_base_variable = "{" . "customer_id" . "}";
311 my $_base_value = $self->{api_client}->to_path_value($args{'customer_id'});
312 $_resource_path =~ s/$_base_variable/$_base_value/g;
313 }
314  
315 my $_body_data;
316 # body params
317 if ( exists $args{'update_billing_address_request'}) {
318 $_body_data = $args{'update_billing_address_request'};
319 }
320  
321 # authentication setting, if any
322 my $auth_settings = [qw(token )];
323  
324 # make the API Call
325 my $response = $self->{api_client}->call_api($_resource_path, $_method,
326 $query_params, $form_params,
327 $header_params, $_body_data, $auth_settings);
328 if (!$response) {
329 return;
330 }
331 my $_response_object = $self->{api_client}->deserialize('BillingAddressResponse', $response);
332 return $_response_object;
333 }
334  
335 1;