File Coverage

lib/Smartcat/Client/ClientApi.pm
Criterion Covered Total %
statement 29 101 28.7
branch 1 30 3.3
condition 2 6 33.3
subroutine 9 12 75.0
pod 0 4 0.0
total 41 153 26.8


line stmt bran cond sub pod time code
1              
2             =begin comment
3              
4             Smartcat Integration API
5              
6             No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
7              
8             OpenAPI spec version: v1
9              
10             Generated by: https://github.com/swagger-api/swagger-codegen.git
11              
12             =end comment
13              
14             =cut
15              
16             #
17             # NOTE: This class is auto generated by the swagger code generator program.
18             # Do not edit the class manually.
19             # Ref: https://github.com/swagger-api/swagger-codegen
20             #
21             package Smartcat::Client::ClientApi;
22              
23             require 5.6.0;
24 1     1   729 use strict;
  1         2  
  1         29  
25 1     1   7 use warnings;
  1         2  
  1         23  
26 1     1   584 use utf8;
  1         14  
  1         5  
27 1     1   31 use Exporter;
  1         1  
  1         38  
28 1     1   5 use Carp qw( croak );
  1         2  
  1         47  
29 1     1   458 use Log::Any qw($log);
  1         8328  
  1         5  
30              
31 1     1   2587 use Smartcat::Client::ApiClient;
  1         3  
  1         36  
32              
33 1     1   7 use base "Class::Data::Inheritable";
  1         2  
  1         476  
34              
35             __PACKAGE__->mk_classdata( 'method_documentation' => {} );
36              
37             sub new {
38 1     1 0 583 my $class = shift;
39 1         2 my $api_client;
40              
41 1 50 33     7 if ( $_[0] && ref $_[0] && ref $_[0] eq 'Smartcat::Client::ApiClient' ) {
      33        
42 0         0 $api_client = $_[0];
43             }
44             else {
45 1         6 $api_client = Smartcat::Client::ApiClient->new(@_);
46             }
47              
48 1         5 bless { api_client => $api_client }, $class;
49              
50             }
51              
52             #
53             # client_create_client
54             #
55             # Create a new client with the specified name and return their ID. Simply return the ID if a client with that name already exists
56             #
57             # @param string $name client's name (required)
58             {
59             my $params = {
60             'name' => {
61             data_type => 'string',
62             description => 'client's name',
63             required => '1',
64             },
65             };
66             __PACKAGE__->method_documentation->{'client_create_client'} = {
67             summary =>
68             'Create a new client with the specified name and return their ID. Simply return the ID if a client with that name already exists',
69             params => $params,
70             returns => 'string',
71             };
72             }
73              
74             # @return string
75             #
76             sub client_create_client {
77 0     0 0   my ( $self, %args ) = @_;
78              
79             # verify the required parameter 'name' is set
80 0 0         unless ( exists $args{'name'} ) {
81 0           croak(
82             "Missing the required parameter 'name' when calling client_create_client"
83             );
84             }
85              
86             # parse inputs
87 0           my $_resource_path = '/api/integration/v1/client/create';
88              
89 0           my $_method = 'POST';
90 0           my $query_params = {};
91 0           my $header_params = {};
92 0           my $form_params = {};
93              
94             # 'Accept' and 'Content-Type' header
95             my $_header_accept = $self->{api_client}
96 0           ->select_header_accept( 'application/json', 'text/json' );
97 0 0         if ($_header_accept) {
98 0           $header_params->{'Accept'} = $_header_accept;
99             }
100             $header_params->{'Content-Type'} = $self->{api_client}
101 0           ->select_header_content_type( 'application/json', 'text/json' );
102              
103 0           my $_body_data;
104              
105             # body params
106 0 0         if ( exists $args{'name'} ) {
107 0           $_body_data = $args{'name'};
108             }
109              
110             # authentication setting, if any
111 0           my $auth_settings = [qw()];
112              
113             # make the API Call
114             my $response = $self->{api_client}->call_api(
115 0           $_resource_path, $_method, $query_params, $form_params,
116             $header_params, $_body_data, $auth_settings
117             );
118 0 0         if ( !$response ) {
119 0           return;
120             }
121             my $_response_object =
122 0           $self->{api_client}->deserialize( 'string', $response );
123 0           return $_response_object;
124             }
125              
126             #
127             # client_get_client
128             #
129             #
130             #
131             # @param string $client_id (required)
132             {
133             my $params = {
134             'client_id' => {
135             data_type => 'string',
136             description => '',
137             required => '1',
138             },
139             };
140             __PACKAGE__->method_documentation->{'client_get_client'} = {
141             summary => '',
142             params => $params,
143             returns => 'ClientModel',
144             };
145             }
146              
147             # @return ClientModel
148             #
149             sub client_get_client {
150 0     0 0   my ( $self, %args ) = @_;
151              
152             # verify the required parameter 'client_id' is set
153 0 0         unless ( exists $args{'client_id'} ) {
154 0           croak(
155             "Missing the required parameter 'client_id' when calling client_get_client"
156             );
157             }
158              
159             # parse inputs
160 0           my $_resource_path = '/api/integration/v1/client/{clientId}';
161              
162 0           my $_method = 'GET';
163 0           my $query_params = {};
164 0           my $header_params = {};
165 0           my $form_params = {};
166              
167             # 'Accept' and 'Content-Type' header
168             my $_header_accept = $self->{api_client}
169 0           ->select_header_accept( 'application/json', 'text/json' );
170 0 0         if ($_header_accept) {
171 0           $header_params->{'Accept'} = $_header_accept;
172             }
173             $header_params->{'Content-Type'} =
174 0           $self->{api_client}->select_header_content_type();
175              
176             # path params
177 0 0         if ( exists $args{'client_id'} ) {
178 0           my $_base_variable = "{" . "clientId" . "}";
179             my $_base_value =
180 0           $self->{api_client}->to_path_value( $args{'client_id'} );
181 0           $_resource_path =~ s/$_base_variable/$_base_value/g;
182             }
183              
184 0           my $_body_data;
185              
186             # authentication setting, if any
187 0           my $auth_settings = [qw()];
188              
189             # make the API Call
190             my $response = $self->{api_client}->call_api(
191 0           $_resource_path, $_method, $query_params, $form_params,
192             $header_params, $_body_data, $auth_settings
193             );
194 0 0         if ( !$response ) {
195 0           return;
196             }
197             my $_response_object =
198 0           $self->{api_client}->deserialize( 'ClientModel', $response );
199 0           return $_response_object;
200             }
201              
202             #
203             # client_set_client_net_rate
204             #
205             #
206             #
207             # @param string $client_id (required)
208             # @param string $net_rate_id (required)
209             {
210             my $params = {
211             'client_id' => {
212             data_type => 'string',
213             description => '',
214             required => '1',
215             },
216             'net_rate_id' => {
217             data_type => 'string',
218             description => '',
219             required => '1',
220             },
221             };
222             __PACKAGE__->method_documentation->{'client_set_client_net_rate'} = {
223             summary => '',
224             params => $params,
225             returns => 'ClientModel',
226             };
227             }
228              
229             # @return ClientModel
230             #
231             sub client_set_client_net_rate {
232 0     0 0   my ( $self, %args ) = @_;
233              
234             # verify the required parameter 'client_id' is set
235 0 0         unless ( exists $args{'client_id'} ) {
236 0           croak(
237             "Missing the required parameter 'client_id' when calling client_set_client_net_rate"
238             );
239             }
240              
241             # verify the required parameter 'net_rate_id' is set
242 0 0         unless ( exists $args{'net_rate_id'} ) {
243 0           croak(
244             "Missing the required parameter 'net_rate_id' when calling client_set_client_net_rate"
245             );
246             }
247              
248             # parse inputs
249 0           my $_resource_path = '/api/integration/v1/client/{clientId}/set';
250              
251 0           my $_method = 'PUT';
252 0           my $query_params = {};
253 0           my $header_params = {};
254 0           my $form_params = {};
255              
256             # 'Accept' and 'Content-Type' header
257             my $_header_accept = $self->{api_client}
258 0           ->select_header_accept( 'application/json', 'text/json' );
259 0 0         if ($_header_accept) {
260 0           $header_params->{'Accept'} = $_header_accept;
261             }
262             $header_params->{'Content-Type'} =
263 0           $self->{api_client}->select_header_content_type();
264              
265             # query params
266 0 0         if ( exists $args{'net_rate_id'} ) {
267             $query_params->{'netRateId'} =
268 0           $self->{api_client}->to_query_value( $args{'net_rate_id'} );
269             }
270              
271             # path params
272 0 0         if ( exists $args{'client_id'} ) {
273 0           my $_base_variable = "{" . "clientId" . "}";
274             my $_base_value =
275 0           $self->{api_client}->to_path_value( $args{'client_id'} );
276 0           $_resource_path =~ s/$_base_variable/$_base_value/g;
277             }
278              
279 0           my $_body_data;
280              
281             # authentication setting, if any
282 0           my $auth_settings = [qw()];
283              
284             # make the API Call
285             my $response = $self->{api_client}->call_api(
286 0           $_resource_path, $_method, $query_params, $form_params,
287             $header_params, $_body_data, $auth_settings
288             );
289 0 0         if ( !$response ) {
290 0           return;
291             }
292             my $_response_object =
293 0           $self->{api_client}->deserialize( 'ClientModel', $response );
294 0           return $_response_object;
295             }
296              
297             1;