Fastly/ImageOptimizerDefaultSettingsApi.pm untested

filter: Statementstmt 0.0% 0 / 104 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 156 CC 15 SCAR 36.5
CC
15
Cov
0%
update_default_settings
72.0
get_default_settings
56.0
new
6.0
CRAP 38.4
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::ImageOptimizerDefaultSettingsApi;
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 # get_default_settings
51 #
52 # Get current Image Optimizer Default Settings
53 #
54 # @param string $service_id Alphanumeric string identifying the service. (required)
55 # @param int $version_id Integer identifying a service version. (required)
56 {
57 my $params = {
58 'service_id' => {
59 data_type => 'string',
60 description => 'Alphanumeric string identifying the service.',
61 required => '1',
62 },
63 'version_id' => {
64 data_type => 'int',
65 description => 'Integer identifying a service version.',
66 required => '1',
67 },
68 };
69 __PACKAGE__->method_documentation->{ 'get_default_settings' } = {
70 summary => 'Get current Image Optimizer Default Settings',
71 params => $params,
72 returns => 'DefaultSettingsResponse',
73 };
74 }
75 # @return DefaultSettingsResponse
76 #
77 sub get_default_settings {
78 my ($self, %args) = @_;
79  
80 # verify the required parameter 'service_id' is set
81 unless (exists $args{'service_id'}) {
82 croak("Missing the required parameter 'service_id' when calling get_default_settings");
83 }
84  
85 # verify the required parameter 'version_id' is set
86 unless (exists $args{'version_id'}) {
87 croak("Missing the required parameter 'version_id' when calling get_default_settings");
88 }
89  
90 # parse inputs
91 my $_resource_path = '/service/{service_id}/version/{version_id}/image_optimizer_default_settings';
92  
93 my $_method = 'GET';
94 my $query_params = {};
95 my $header_params = {};
96 my $form_params = {};
97  
98 # 'Accept' and 'Content-Type' header
99 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
100 if ($_header_accept) {
101 $header_params->{'Accept'} = $_header_accept;
102 }
103 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type();
104  
105 # path params
106 if ( exists $args{'service_id'}) {
107 my $_base_variable = "{" . "service_id" . "}";
108 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
109 $_resource_path =~ s/$_base_variable/$_base_value/g;
110 }
111  
112 # path params
113 if ( exists $args{'version_id'}) {
114 my $_base_variable = "{" . "version_id" . "}";
115 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
116 $_resource_path =~ s/$_base_variable/$_base_value/g;
117 }
118  
119 my $_body_data;
120 # authentication setting, if any
121 my $auth_settings = [qw(token )];
122  
123 # make the API Call
124 my $response = $self->{api_client}->call_api($_resource_path, $_method,
125 $query_params, $form_params,
126 $header_params, $_body_data, $auth_settings);
127 if (!$response) {
128 return;
129 }
130 my $_response_object = $self->{api_client}->deserialize('DefaultSettingsResponse', $response);
131 return $_response_object;
132 }
133  
134 #
135 # update_default_settings
136 #
137 # Update Image Optimizer Default Settings
138 #
139 # @param string $service_id Alphanumeric string identifying the service. (required)
140 # @param int $version_id Integer identifying a service version. (required)
141 # @param DefaultSettings $default_settings (optional)
142 {
143 my $params = {
144 'service_id' => {
145 data_type => 'string',
146 description => 'Alphanumeric string identifying the service.',
147 required => '1',
148 },
149 'version_id' => {
150 data_type => 'int',
151 description => 'Integer identifying a service version.',
152 required => '1',
153 },
154 'default_settings' => {
155 data_type => 'DefaultSettings',
156 description => '',
157 required => '0',
158 },
159 };
160 __PACKAGE__->method_documentation->{ 'update_default_settings' } = {
161 summary => 'Update Image Optimizer Default Settings',
162 params => $params,
163 returns => 'DefaultSettingsResponse',
164 };
165 }
166 # @return DefaultSettingsResponse
167 #
168 sub update_default_settings {
169 my ($self, %args) = @_;
170  
171 # verify the required parameter 'service_id' is set
172 unless (exists $args{'service_id'}) {
173 croak("Missing the required parameter 'service_id' when calling update_default_settings");
174 }
175  
176 # verify the required parameter 'version_id' is set
177 unless (exists $args{'version_id'}) {
178 croak("Missing the required parameter 'version_id' when calling update_default_settings");
179 }
180  
181 # parse inputs
182 my $_resource_path = '/service/{service_id}/version/{version_id}/image_optimizer_default_settings';
183  
184 my $_method = 'PATCH';
185 my $query_params = {};
186 my $header_params = {};
187 my $form_params = {};
188  
189 # 'Accept' and 'Content-Type' header
190 my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/problem+json');
191 if ($_header_accept) {
192 $header_params->{'Accept'} = $_header_accept;
193 }
194 $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
195  
196 # path params
197 if ( exists $args{'service_id'}) {
198 my $_base_variable = "{" . "service_id" . "}";
199 my $_base_value = $self->{api_client}->to_path_value($args{'service_id'});
200 $_resource_path =~ s/$_base_variable/$_base_value/g;
201 }
202  
203 # path params
204 if ( exists $args{'version_id'}) {
205 my $_base_variable = "{" . "version_id" . "}";
206 my $_base_value = $self->{api_client}->to_path_value($args{'version_id'});
207 $_resource_path =~ s/$_base_variable/$_base_value/g;
208 }
209  
210 my $_body_data;
211 # body params
212 if ( exists $args{'default_settings'}) {
213 $_body_data = $args{'default_settings'};
214 }
215  
216 # authentication setting, if any
217 my $auth_settings = [qw(token )];
218  
219 # make the API Call
220 my $response = $self->{api_client}->call_api($_resource_path, $_method,
221 $query_params, $form_params,
222 $header_params, $_body_data, $auth_settings);
223 if (!$response) {
224 return;
225 }
226 my $_response_object = $self->{api_client}->deserialize('DefaultSettingsResponse', $response);
227 return $_response_object;
228 }
229  
230 1;