aspose_diagram_cloud 18.10.3 → 19.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{aspose_diagram_cloud.gemspec → AsposeDiagramCloud.gemspec} +5 -5
- data/README.md +94 -124
- data/docs/{FileFormatRequest.md → CreateNewResponse.md} +2 -2
- data/docs/DiagramApi.md +241 -0
- data/docs/DiagramSaveOptions.md +10 -0
- data/docs/DiscUsage.md +9 -0
- data/docs/Error.md +11 -0
- data/docs/ErrorDetails.md +9 -0
- data/docs/FileVersion.md +14 -0
- data/docs/FileVersions.md +8 -0
- data/docs/FilesList.md +8 -0
- data/docs/FilesUploadResult.md +9 -0
- data/docs/HTMLSaveOptions.md +19 -0
- data/docs/ImageSaveOptions.md +29 -0
- data/docs/ModifyResponse.md +9 -0
- data/docs/OAuthApi.md +3 -3
- data/docs/ObjectExist.md +9 -0
- data/docs/PageSize.md +8 -0
- data/docs/PdfDigitalSignatureDetails.md +11 -0
- data/docs/PdfEncryptionDetails.md +11 -0
- data/docs/PdfSaveOptions.md +25 -0
- data/docs/PointF.md +10 -0
- data/docs/RectangleF.md +18 -0
- data/docs/RenderingSaveOptions.md +13 -0
- data/docs/SVGSaveOptions.md +18 -0
- data/docs/SWFSaveOptions.md +13 -0
- data/docs/SaaSposeResponse.md +0 -2
- data/docs/SaveAsResponse.md +10 -0
- data/docs/SaveOptionsModel.md +9 -0
- data/docs/SaveOptionsRequest.md +10 -0
- data/docs/StorageApi.md +799 -0
- data/docs/StorageExist.md +8 -0
- data/docs/StorageFile.md +12 -0
- data/docs/{SharpModel.md → UploadResponse.md} +2 -2
- data/docs/XAMLSaveOptions.md +12 -0
- data/docs/XPSSaveOptions.md +13 -0
- data/lib/AsposeDiagramCloud.rb +74 -0
- data/lib/AsposeDiagramCloud/api/diagram_api.rb +300 -0
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/api/o_auth_api.rb +3 -3
- data/lib/AsposeDiagramCloud/api/storage_api.rb +905 -0
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/api_client.rb +7 -4
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/api_error.rb +2 -2
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/configuration.rb +4 -18
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/models/access_token_response.rb +2 -2
- data/lib/{aspose_diagram_cloud/models/file_format_request.rb → AsposeDiagramCloud/models/create_new_response.rb} +10 -10
- data/lib/AsposeDiagramCloud/models/diagram_save_options.rb +244 -0
- data/lib/{aspose_diagram_cloud/models/link.rb → AsposeDiagramCloud/models/disc_usage.rb} +29 -35
- data/lib/AsposeDiagramCloud/models/error.rb +219 -0
- data/lib/{aspose_diagram_cloud/models/saa_spose_response.rb → AsposeDiagramCloud/models/error_details.rb} +22 -20
- data/lib/AsposeDiagramCloud/models/file_version.rb +264 -0
- data/lib/{aspose_diagram_cloud/models/page_model.rb → AsposeDiagramCloud/models/file_versions.rb} +13 -21
- data/lib/AsposeDiagramCloud/models/files_list.rb +191 -0
- data/lib/AsposeDiagramCloud/models/files_upload_result.rb +203 -0
- data/lib/AsposeDiagramCloud/models/html_save_options.rb +330 -0
- data/lib/AsposeDiagramCloud/models/image_save_options.rb +492 -0
- data/lib/AsposeDiagramCloud/models/modify_response.rb +202 -0
- data/lib/{aspose_diagram_cloud/models/diagram_response.rb → AsposeDiagramCloud/models/object_exist.rb} +27 -29
- data/lib/AsposeDiagramCloud/models/page_size.rb +221 -0
- data/lib/AsposeDiagramCloud/models/pdf_digital_signature_details.rb +248 -0
- data/lib/AsposeDiagramCloud/models/pdf_encryption_details.rb +260 -0
- data/lib/AsposeDiagramCloud/models/pdf_save_options.rb +408 -0
- data/lib/{aspose_diagram_cloud/models/save_result.rb → AsposeDiagramCloud/models/point_f.rb} +37 -24
- data/lib/AsposeDiagramCloud/models/rectangle_f.rb +333 -0
- data/lib/AsposeDiagramCloud/models/rendering_save_options.rb +276 -0
- data/lib/{aspose_diagram_cloud/models/sharp_model.rb → AsposeDiagramCloud/models/saa_spose_response.rb} +5 -14
- data/lib/{aspose_diagram_cloud/models/save_response.rb → AsposeDiagramCloud/models/save_as_response.rb} +24 -27
- data/lib/AsposeDiagramCloud/models/save_options_model.rb +235 -0
- data/lib/{aspose_diagram_cloud/models/diagram_model.rb → AsposeDiagramCloud/models/save_options_request.rb} +19 -12
- data/lib/AsposeDiagramCloud/models/storage_exist.rb +194 -0
- data/lib/AsposeDiagramCloud/models/storage_file.rb +239 -0
- data/lib/AsposeDiagramCloud/models/svg_save_options.rb +321 -0
- data/lib/AsposeDiagramCloud/models/swf_save_options.rb +271 -0
- data/lib/AsposeDiagramCloud/models/upload_response.rb +188 -0
- data/lib/AsposeDiagramCloud/models/xaml_save_options.rb +262 -0
- data/lib/AsposeDiagramCloud/models/xps_save_options.rb +271 -0
- data/lib/{aspose_diagram_cloud → AsposeDiagramCloud}/version.rb +3 -3
- data/spec/api/test_convert_spec.rb +308 -0
- data/spec/api_client_spec.rb +2 -2
- data/spec/configuration_spec.rb +5 -5
- data/spec/spec_helper.rb +10 -6
- data/testData/FileUpload.vdx +437 -0
- metadata +80 -55
- data/docs/DiagramFileApi.md +0 -228
- data/docs/DiagramModel.md +0 -9
- data/docs/DiagramResponse.md +0 -10
- data/docs/Link.md +0 -11
- data/docs/PageModel.md +0 -9
- data/docs/SaveResponse.md +0 -10
- data/docs/SaveResult.md +0 -10
- data/lib/aspose_diagram_cloud.rb +0 -51
- data/lib/aspose_diagram_cloud/api/diagram_file_api.rb +0 -304
- data/spec/api/diagram_file_api_spec.rb +0 -118
- data/spec/api/o_auth_api_spec.rb +0 -56
- data/spec/models/access_token_response_spec.rb +0 -84
- data/spec/models/diagram_model_spec.rb +0 -48
- data/spec/models/diagram_response_spec.rb +0 -54
- data/spec/models/file_format_request_spec.rb +0 -42
- data/spec/models/link_spec.rb +0 -60
- data/spec/models/page_model_spec.rb +0 -48
- data/spec/models/saa_spose_response_spec.rb +0 -48
- data/spec/models/save_response_spec.rb +0 -54
- data/spec/models/save_result_spec.rb +0 -54
- data/spec/models/sharp_model_spec.rb +0 -42
data/lib/{aspose_diagram_cloud/models/page_model.rb → AsposeDiagramCloud/models/file_versions.rb}
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
=begin
|
2
|
-
#
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
3
|
|
4
4
|
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
5
|
|
6
|
-
OpenAPI spec version:
|
6
|
+
OpenAPI spec version: 3.0
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
9
|
Swagger Codegen version: 2.3.0-SNAPSHOT
|
@@ -13,26 +13,23 @@ Swagger Codegen version: 2.3.0-SNAPSHOT
|
|
13
13
|
require 'date'
|
14
14
|
|
15
15
|
module AsposeDiagramCloud
|
16
|
-
|
17
|
-
class
|
18
|
-
|
19
|
-
|
20
|
-
attr_accessor :sharps
|
16
|
+
# File versions FileVersion.
|
17
|
+
class FileVersions
|
18
|
+
# File versions FileVersion.
|
19
|
+
attr_accessor :value
|
21
20
|
|
22
21
|
|
23
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
23
|
def self.attribute_map
|
25
24
|
{
|
26
|
-
:'
|
27
|
-
:'sharps' => :'Sharps'
|
25
|
+
:'value' => :'Value'
|
28
26
|
}
|
29
27
|
end
|
30
28
|
|
31
29
|
# Attribute type mapping.
|
32
30
|
def self.swagger_types
|
33
31
|
{
|
34
|
-
:'
|
35
|
-
:'sharps' => :'Array<SharpModel>'
|
32
|
+
:'value' => :'Array<FileVersion>'
|
36
33
|
}
|
37
34
|
end
|
38
35
|
|
@@ -44,13 +41,9 @@ module AsposeDiagramCloud
|
|
44
41
|
# convert string to symbol for hash key
|
45
42
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
46
43
|
|
47
|
-
if attributes.has_key?(:'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
if attributes.has_key?(:'Sharps')
|
52
|
-
if (value = attributes[:'Sharps']).is_a?(Array)
|
53
|
-
self.sharps = value
|
44
|
+
if attributes.has_key?(:'Value')
|
45
|
+
if (value = attributes[:'Value']).is_a?(Array)
|
46
|
+
self.value = value
|
54
47
|
end
|
55
48
|
end
|
56
49
|
|
@@ -74,8 +67,7 @@ module AsposeDiagramCloud
|
|
74
67
|
def ==(o)
|
75
68
|
return true if self.equal?(o)
|
76
69
|
self.class == o.class &&
|
77
|
-
|
78
|
-
sharps == o.sharps
|
70
|
+
value == o.value
|
79
71
|
end
|
80
72
|
|
81
73
|
# @see the `==` method
|
@@ -87,7 +79,7 @@ module AsposeDiagramCloud
|
|
87
79
|
# Calculates hash code according to all attributes.
|
88
80
|
# @return [Fixnum] Hash code
|
89
81
|
def hash
|
90
|
-
[
|
82
|
+
[value].hash
|
91
83
|
end
|
92
84
|
|
93
85
|
# Builds the object from hash
|
@@ -0,0 +1,191 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AsposeDiagramCloud
|
16
|
+
# Files list
|
17
|
+
class FilesList
|
18
|
+
# Files and folders contained by folder StorageFile.
|
19
|
+
attr_accessor :value
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'value' => :'Value'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.swagger_types
|
31
|
+
{
|
32
|
+
:'value' => :'Array<StorageFile>'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initializes the object
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
+
def initialize(attributes = {})
|
39
|
+
return unless attributes.is_a?(Hash)
|
40
|
+
|
41
|
+
# convert string to symbol for hash key
|
42
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
43
|
+
|
44
|
+
if attributes.has_key?(:'Value')
|
45
|
+
if (value = attributes[:'Value']).is_a?(Array)
|
46
|
+
self.value = value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
53
|
+
# @return Array for valid properies with the reasons
|
54
|
+
def list_invalid_properties
|
55
|
+
invalid_properties = Array.new
|
56
|
+
return invalid_properties
|
57
|
+
end
|
58
|
+
|
59
|
+
# Check to see if the all the properties in the model are valid
|
60
|
+
# @return true if the model is valid
|
61
|
+
def valid?
|
62
|
+
return true
|
63
|
+
end
|
64
|
+
|
65
|
+
# Checks equality by comparing each attribute.
|
66
|
+
# @param [Object] Object to be compared
|
67
|
+
def ==(o)
|
68
|
+
return true if self.equal?(o)
|
69
|
+
self.class == o.class &&
|
70
|
+
value == o.value
|
71
|
+
end
|
72
|
+
|
73
|
+
# @see the `==` method
|
74
|
+
# @param [Object] Object to be compared
|
75
|
+
def eql?(o)
|
76
|
+
self == o
|
77
|
+
end
|
78
|
+
|
79
|
+
# Calculates hash code according to all attributes.
|
80
|
+
# @return [Fixnum] Hash code
|
81
|
+
def hash
|
82
|
+
[value].hash
|
83
|
+
end
|
84
|
+
|
85
|
+
# Builds the object from hash
|
86
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
87
|
+
# @return [Object] Returns the model itself
|
88
|
+
def build_from_hash(attributes)
|
89
|
+
return nil unless attributes.is_a?(Hash)
|
90
|
+
self.class.swagger_types.each_pair do |key, type|
|
91
|
+
if type =~ /\AArray<(.*)>/i
|
92
|
+
# check to ensure the input is an array given that the the attribute
|
93
|
+
# is documented as an array but the input is not
|
94
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
95
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
96
|
+
end
|
97
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
98
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
99
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
100
|
+
end
|
101
|
+
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
# Deserializes the data based on type
|
106
|
+
# @param string type Data type
|
107
|
+
# @param string value Value to be deserialized
|
108
|
+
# @return [Object] Deserialized data
|
109
|
+
def _deserialize(type, value)
|
110
|
+
case type.to_sym
|
111
|
+
when :DateTime
|
112
|
+
DateTime.parse(value)
|
113
|
+
when :Date
|
114
|
+
Date.parse(value)
|
115
|
+
when :String
|
116
|
+
value.to_s
|
117
|
+
when :Integer
|
118
|
+
value.to_i
|
119
|
+
when :Float
|
120
|
+
value.to_f
|
121
|
+
when :BOOLEAN
|
122
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
126
|
+
end
|
127
|
+
when :Object
|
128
|
+
# generic object (usually a Hash), return directly
|
129
|
+
value
|
130
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
131
|
+
inner_type = Regexp.last_match[:inner_type]
|
132
|
+
value.map { |v| _deserialize(inner_type, v) }
|
133
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
134
|
+
k_type = Regexp.last_match[:k_type]
|
135
|
+
v_type = Regexp.last_match[:v_type]
|
136
|
+
{}.tap do |hash|
|
137
|
+
value.each do |k, v|
|
138
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
else # model
|
142
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
143
|
+
temp_model.build_from_hash(value)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns the string representation of the object
|
148
|
+
# @return [String] String presentation of the object
|
149
|
+
def to_s
|
150
|
+
to_hash.to_s
|
151
|
+
end
|
152
|
+
|
153
|
+
# to_body is an alias to to_hash (backward compatibility)
|
154
|
+
# @return [Hash] Returns the object in the form of hash
|
155
|
+
def to_body
|
156
|
+
to_hash
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the object in the form of hash
|
160
|
+
# @return [Hash] Returns the object in the form of hash
|
161
|
+
def to_hash
|
162
|
+
hash = {}
|
163
|
+
self.class.attribute_map.each_pair do |attr, param|
|
164
|
+
value = self.send(attr)
|
165
|
+
next if value.nil?
|
166
|
+
hash[param] = _to_hash(value)
|
167
|
+
end
|
168
|
+
hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Outputs non-array value in the form of hash
|
172
|
+
# For object, use to_hash. Otherwise, just return the value
|
173
|
+
# @param [Object] value Any valid value
|
174
|
+
# @return [Hash] Returns the value in the form of hash
|
175
|
+
def _to_hash(value)
|
176
|
+
if value.is_a?(Array)
|
177
|
+
value.compact.map{ |v| _to_hash(v) }
|
178
|
+
elsif value.is_a?(Hash)
|
179
|
+
{}.tap do |hash|
|
180
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
181
|
+
end
|
182
|
+
elsif value.respond_to? :to_hash
|
183
|
+
value.to_hash
|
184
|
+
else
|
185
|
+
value
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
@@ -0,0 +1,203 @@
|
|
1
|
+
=begin
|
2
|
+
#Aspose.Diagram Cloud API Reference
|
3
|
+
|
4
|
+
#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
|
5
|
+
|
6
|
+
OpenAPI spec version: 3.0
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.3.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AsposeDiagramCloud
|
16
|
+
# File upload result
|
17
|
+
class FilesUploadResult
|
18
|
+
# List of uploaded file names
|
19
|
+
attr_accessor :uploaded
|
20
|
+
|
21
|
+
# List of errors.
|
22
|
+
attr_accessor :errors
|
23
|
+
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'uploaded' => :'Uploaded',
|
29
|
+
:'errors' => :'Errors'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Attribute type mapping.
|
34
|
+
def self.swagger_types
|
35
|
+
{
|
36
|
+
:'uploaded' => :'Array<String>',
|
37
|
+
:'errors' => :'Array<Error>'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
|
+
|
49
|
+
if attributes.has_key?(:'Uploaded')
|
50
|
+
if (value = attributes[:'Uploaded']).is_a?(Array)
|
51
|
+
self.uploaded = value
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if attributes.has_key?(:'Errors')
|
56
|
+
if (value = attributes[:'Errors']).is_a?(Array)
|
57
|
+
self.errors = value
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properies with the reasons
|
65
|
+
def list_invalid_properties
|
66
|
+
invalid_properties = Array.new
|
67
|
+
return invalid_properties
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
return true
|
74
|
+
end
|
75
|
+
|
76
|
+
# Checks equality by comparing each attribute.
|
77
|
+
# @param [Object] Object to be compared
|
78
|
+
def ==(o)
|
79
|
+
return true if self.equal?(o)
|
80
|
+
self.class == o.class &&
|
81
|
+
uploaded == o.uploaded &&
|
82
|
+
errors == o.errors
|
83
|
+
end
|
84
|
+
|
85
|
+
# @see the `==` method
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def eql?(o)
|
88
|
+
self == o
|
89
|
+
end
|
90
|
+
|
91
|
+
# Calculates hash code according to all attributes.
|
92
|
+
# @return [Fixnum] Hash code
|
93
|
+
def hash
|
94
|
+
[uploaded, errors].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def build_from_hash(attributes)
|
101
|
+
return nil unless attributes.is_a?(Hash)
|
102
|
+
self.class.swagger_types.each_pair do |key, type|
|
103
|
+
if type =~ /\AArray<(.*)>/i
|
104
|
+
# check to ensure the input is an array given that the the attribute
|
105
|
+
# is documented as an array but the input is not
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
108
|
+
end
|
109
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
111
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
112
|
+
end
|
113
|
+
|
114
|
+
self
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserializes the data based on type
|
118
|
+
# @param string type Data type
|
119
|
+
# @param string value Value to be deserialized
|
120
|
+
# @return [Object] Deserialized data
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :BOOLEAN
|
134
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
temp_model = AsposeDiagramCloud.const_get(type).new
|
155
|
+
temp_model.build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the string representation of the object
|
160
|
+
# @return [String] String presentation of the object
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_hash (backward compatibility)
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the object in the form of hash
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_hash
|
174
|
+
hash = {}
|
175
|
+
self.class.attribute_map.each_pair do |attr, param|
|
176
|
+
value = self.send(attr)
|
177
|
+
next if value.nil?
|
178
|
+
hash[param] = _to_hash(value)
|
179
|
+
end
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Outputs non-array value in the form of hash
|
184
|
+
# For object, use to_hash. Otherwise, just return the value
|
185
|
+
# @param [Object] value Any valid value
|
186
|
+
# @return [Hash] Returns the value in the form of hash
|
187
|
+
def _to_hash(value)
|
188
|
+
if value.is_a?(Array)
|
189
|
+
value.compact.map{ |v| _to_hash(v) }
|
190
|
+
elsif value.is_a?(Hash)
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
193
|
+
end
|
194
|
+
elsif value.respond_to? :to_hash
|
195
|
+
value.to_hash
|
196
|
+
else
|
197
|
+
value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
|
203
|
+
end
|