lib/Smartcat/Client/Object/ModelWithFilesUploadDocumentPropertiesModel.pm

filter: Statementstmt 65.4% 55 / 84 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 76.4% 13 / 17 Podpod 25.0% 1 / 4 totaltotal 58.9% 69 / 117 CC 10 SCAR 22.2
CC
10
Cov
57%
from_hash
30.0
TO_JSON
12.0
_deserialize
12.0
CRAP 9.2
« lib/Smartcat/Client/Object/ModelWithFilesIReadOnlyListCreateDocumentPropertyModel.pm ↑ Summary lib/Smartcat/Client/Object/ProjectModel.pm »
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::Object::ModelWithFilesUploadDocumentPropertiesModel;
22  
23 1 require 5.6.0;
24 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use JSON qw(decode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use Module::Runtime qw(use_module);
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use Date::Parse;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
33  
34 1 ▶use Smartcat::Client::Object::UploadDocumentPropertiesModel;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶use Smartcat::Client::Object::UploadedFile;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 1 ▶use base ( "Class::Accessor", "Class::Data::Inheritable" );
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 #
40 #
41 #
42 # NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
43 # REF: https://github.com/swagger-api/swagger-codegen
44 #
45  
46 =begin comment
47  
48 Smartcat Integration API
49  
50 No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
51  
52 OpenAPI spec version: v1
53  
54 Generated by: https://github.com/swagger-api/swagger-codegen.git
55  
56 =end comment
57  
58 =cut
59  
60 #
61 # NOTE: This class is auto generated by the swagger code generator program.
62 # Do not edit the class manually.
63 # Ref: https://github.com/swagger-api/swagger-codegen
64 #
65 1 __PACKAGE__->mk_classdata( 'attribute_map' => {} );
66 1 __PACKAGE__->mk_classdata( 'swagger_types' => {} );
67 1 __PACKAGE__->mk_classdata( 'method_documentation' => {} );
68 1 __PACKAGE__->mk_classdata( 'class_documentation' => {} );
69  
70 # new object
71 1 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
72 1 my ( $class, %args ) = @_;
73  
74 1 my $self = bless {}, $class;
75  
76 1 foreach my $attribute ( keys %{ $class->attribute_map } ) {
77 2 my $args_key = $class->attribute_map->{$attribute};
78 2 $self->$attribute( $args{$args_key} );
79 }
80  
81 1 return $self;
82 }
83  
84 # return perl hash
85 0 ▶sub to_hash {
Subroutine to_hash: not called CC=1 SCAR=6.9
Pod undocumented
86 0 return decode_json( JSON->new->convert_blessed->encode(shift) );
87 }
88  
89 # used by JSON for serialization
90 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=3 SCAR=24.8
Pod undocumented
91 0 my $self = shift;
92 0 my $_data = {};
93 0 foreach my $_key ( keys %{ $self->attribute_map } ) {
94 0 ▶ if ( defined $self->{$_key} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{$_key}) 0 0 0
95 0 $_data->{ $self->attribute_map->{$_key} } = $self->{$_key};
96 }
97 }
98 0 return $_data;
99 }
100  
101 # from Perl hashref
102 0 ▶sub from_hash {
Subroutine from_hash: not called CC=5 SCAR=34.0
Pod undocumented
103 0 my ( $self, $hash ) = @_;
104  
105 # loop through attributes and use swagger_types to deserialize the data
106 0 ▶ while ( my ( $_key, $_type ) = each %{ $self->swagger_types } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %{$self->swagger_types;}) 0 0 0
107 0 my $_json_attribute = $self->attribute_map->{$_key};
108 0 ▶ if ( $_type =~ /^array\[/i ) { # array
Branch: 2 branches
BranchTrueFalseTotal
if ($_type =~ /^array\[/i) { } 0 0 0
elsif (exists $hash->{$_json_attribute}) { } 0 0 0
109 0 my $_subclass = substr( $_type, 6, -1 );
110 0 my @_array = ();
111 0 foreach my $_element ( @{ $hash->{$_json_attribute} } ) {
112 0 push @_array, $self->_deserialize( $_subclass, $_element );
113 }
114 0 $self->{$_key} = \@_array;
115 }
116 elsif ( exists $hash->{$_json_attribute} )
117 { #hash(model), primitive, datetime
118 $self->{$_key} =
119 0 $self->_deserialize( $_type, $hash->{$_json_attribute} );
120 }
121 else {
122 0 $log->debugf( "Warning: %s (%s) does not exist in input hash\n",
123 $_key, $_json_attribute );
124 }
125 }
126  
127 0 return $self;
128 }
129  
130 # deserialize non-array data
131 0 ▶sub _deserialize {
Subroutine _deserialize: not called CC=3 SCAR=24.8
132 0 my ( $self, $type, $data ) = @_;
133 0 $log->debugf( "deserializing %s with %s", Dumper($data), $type );
134  
135 0 ▶ if ( $type eq 'DateTime' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'DateTime') { } 0 0 0
elsif (grep /^$type$/, ('int', 'double', 'string', 'boolean')) { } 0 0 0
136 0 return DateTime->from_epoch( epoch => str2time($data) );
137 }
138 elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) {
139 0 return $data;
140 }
141 else { # hash(model)
142 0 my $_instance = eval "Smartcat::Client::Object::$type->new()";
143 0 return $_instance->from_hash($data);
144 }
145 }
146  
147 1 __PACKAGE__->class_documentation(
148 {
149 description => '',
150 class => 'ModelWithFilesUploadDocumentPropertiesModel',
151 required => [], # TODO
152 }
153 );
154  
155 1 __PACKAGE__->method_documentation(
156 {
157 'value' => {
158 datatype => 'UploadDocumentPropertiesModel',
159 base_name => 'Value',
160 description => '',
161 format => '',
162 read_only => '',
163 },
164 'files' => {
165 datatype => 'ARRAY[UploadedFile]',
166 base_name => 'Files',
167 description => '',
168 format => '',
169 read_only => '',
170 },
171 }
172 );
173  
174 1 __PACKAGE__->swagger_types(
175 {
176 'value' => 'UploadDocumentPropertiesModel',
177 'files' => 'ARRAY[UploadedFile]'
178 }
179 );
180  
181 1 __PACKAGE__->attribute_map(
182 {
183 'value' => 'Value',
184 'files' => 'Files'
185 }
186 );
187  
188 1 __PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } );
189  
190 1 1;
« lib/Smartcat/Client/Object/ModelWithFilesIReadOnlyListCreateDocumentPropertyModel.pm ↑ Summary lib/Smartcat/Client/Object/ProjectModel.pm »