Fastly/CustomerAddressesApi.pm untested

filter: Statementstmt 0.0% 0 / 110 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 160 CC 13 SCAR 29.3
CC
13
Cov
0%
update_customer_address
42.0
create_customer_address
30.0
list_customer_addresses
12.0
CRAP 18.7
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::CustomerAddressesApi;
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 # create_customer_address
51 #
52 # Creates an address associated with a customer account.
53 #
54 # @param CustomerAddress $customer_address (required)
55 {
56 my $params = {
57 'customer_address' => {
58 data_type => 'CustomerAddress',
59 description => '',
60 required => '1',
61 },
62 };
63 __PACKAGE__->method_documentation->{ 'create_customer_address' } = {
64 summary => 'Creates an address associated with a customer account.',
65 params => $params,
66 returns => 'InlineResponse201',
67 };
68 }
69 # @return InlineResponse201
70 #
71 sub create_customer_address {
72 my ($self, %args) = @_;
73  
74 # verify the required parameter 'customer_address' is set
75 unless (exists $args{'customer_address'}) {
76 croak("Missing the required parameter 'customer_address' when calling create_customer_address");
77 }
78  
79 # parse inputs
80 my $_resource_path = '/billing/v3/customer-addresses';
81  
82 my $_method = 'POST';
83 my $query_params = {};
84 my $header_params = {};
85 my $form_params = {};
86  
87 # 'Accept' and 'Content-Type' header
88 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
89 if ($_header_accept) {
90 $header_params->{'Accept'} = $_header_accept;
91 }
92 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
93  
94 my $_body_data;
95 # body params
96 if ( exists $args{'customer_address'}) {
97 $_body_data = $args{'customer_address'};
98 }
99  
100 # authentication setting, if any
101 my $auth_settings = [qw(token )];
102  
103 # make the API Call
104 my $response = $self->{api_client}->call_api($_resource_path, $_method,
105 $query_params, $form_params,
106 $header_params, $_body_data, $auth_settings);
107 if (!$response) {
108 return;
109 }
110 my $_response_object = $self->{api_client}->deserialize('InlineResponse201', $response);
111 return $_response_object;
112 }
113  
114 #
115 # list_customer_addresses
116 #
117 # Return the list of addresses associated with a customer account.
118 #
119 {
120 my $params = {
121 };
122 __PACKAGE__->method_documentation->{ 'list_customer_addresses' } = {
123 summary => 'Return the list of addresses associated with a customer account.',
124 params => $params,
125 returns => 'ListCustomerAddressesResponse',
126 };
127 }
128 # @return ListCustomerAddressesResponse
129 #
130 sub list_customer_addresses {
131 my ($self, %args) = @_;
132  
133 # parse inputs
134 my $_resource_path = '/billing/v3/customer-addresses';
135  
136 my $_method = 'GET';
137 my $query_params = {};
138 my $header_params = {};
139 my $form_params = {};
140  
141 # 'Accept' and 'Content-Type' header
142 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
143 if ($_header_accept) {
144 $header_params->{'Accept'} = $_header_accept;
145 }
146 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
147  
148 my $_body_data;
149 # authentication setting, if any
150 my $auth_settings = [qw(token )];
151  
152 # make the API Call
153 my $response = $self->{api_client}->call_api($_resource_path, $_method,
154 $query_params, $form_params,
155 $header_params, $_body_data, $auth_settings);
156 if (!$response) {
157 return;
158 }
159 my $_response_object = $self->{api_client}->deserialize('ListCustomerAddressesResponse', $response);
160 return $_response_object;
161 }
162  
163 #
164 # update_customer_address
165 #
166 # Updates an address associated with a customer account.
167 #
168 # @param string $type Alphanumeric type of the address being modified. (required)
169 # @param CustomerAddress $customer_address (required)
170 {
171 my $params = {
172 'type' => {
173 data_type => 'string',
174 description => 'Alphanumeric type of the address being modified.',
175 required => '1',
176 },
177 'customer_address' => {
178 data_type => 'CustomerAddress',
179 description => '',
180 required => '1',
181 },
182 };
183 __PACKAGE__->method_documentation->{ 'update_customer_address' } = {
184 summary => 'Updates an address associated with a customer account.',
185 params => $params,
186 returns => undef,
187 };
188 }
189 # @return void
190 #
191 sub update_customer_address {
192 my ($self, %args) = @_;
193  
194 # verify the required parameter 'type' is set
195 unless (exists $args{'type'}) {
196 croak("Missing the required parameter 'type' when calling update_customer_address");
197 }
198  
199 # verify the required parameter 'customer_address' is set
200 unless (exists $args{'customer_address'}) {
201 croak("Missing the required parameter 'customer_address' when calling update_customer_address");
202 }
203  
204 # parse inputs
205 my $_resource_path = '/billing/v3/customer-addresses/{type}';
206  
207 my $_method = 'PUT';
208 my $query_params = {};
209 my $header_params = {};
210 my $form_params = {};
211  
212 # 'Accept' and 'Content-Type' header
213 my $_header_accept = $self->{api_client}->select_header_accept('application/json');
214 if ($_header_accept) {
215 $header_params->{'Accept'} = $_header_accept;
216 }
217 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
218  
219 # path params
220 if ( exists $args{'type'}) {
221 my $_base_variable = "{" . "type" . "}";
222 my $_base_value = $self->{api_client}->to_path_value($args{'type'});
223 $_resource_path =~ s/$_base_variable/$_base_value/g;
224 }
225  
226 my $_body_data;
227 # body params
228 if ( exists $args{'customer_address'}) {
229 $_body_data = $args{'customer_address'};
230 }
231  
232 # authentication setting, if any
233 my $auth_settings = [qw(token )];
234  
235 # make the API Call
236 $self->{api_client}->call_api($_resource_path, $_method,
237 $query_params, $form_params,
238 $header_params, $_body_data, $auth_settings);
239 return;
240 }
241  
242 1;