aspose_cad_cloud 19.11 → 20.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aspose_cad_cloud.rb +10 -0
- data/lib/aspose_cad_cloud/api/cad_api.rb +1118 -168
- data/lib/aspose_cad_cloud/api_client.rb +2 -1
- data/lib/aspose_cad_cloud/configuration.rb +1 -4
- data/lib/aspose_cad_cloud/models/color.rb +1 -9
- data/lib/aspose_cad_cloud/models/disc_usage.rb +227 -0
- data/lib/aspose_cad_cloud/models/error.rb +237 -0
- data/lib/aspose_cad_cloud/models/error_details.rb +222 -0
- data/lib/aspose_cad_cloud/models/file_version.rb +282 -0
- data/lib/aspose_cad_cloud/models/file_versions.rb +209 -0
- data/lib/aspose_cad_cloud/models/files_list.rb +209 -0
- data/lib/aspose_cad_cloud/models/files_upload_result.rb +221 -0
- data/lib/aspose_cad_cloud/models/graphics_options.rb +1 -4
- data/lib/aspose_cad_cloud/models/object_exist.rb +227 -0
- data/lib/aspose_cad_cloud/models/pdf_document_info.rb +1 -5
- data/lib/aspose_cad_cloud/models/pdf_document_options.rb +1 -2
- data/lib/aspose_cad_cloud/models/pen_options.rb +1 -3
- data/lib/aspose_cad_cloud/models/rd_optimizer_settings.rb +1 -8
- data/lib/aspose_cad_cloud/models/requests/CopyFileRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/CopyFolderRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/CreateFolderRequest.rb +49 -0
- data/lib/aspose_cad_cloud/models/requests/DeleteFileRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/requests/DeleteFolderRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/requests/DownloadFileRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/requests/GetDiscUsageRequest.rb +45 -0
- data/lib/aspose_cad_cloud/models/requests/GetDrawingRotateFlipRequest.rb +2 -2
- data/lib/aspose_cad_cloud/models/requests/GetFileVersionsRequest.rb +49 -0
- data/lib/aspose_cad_cloud/models/requests/GetFilesListRequest.rb +49 -0
- data/lib/aspose_cad_cloud/models/requests/MoveFileRequest.rb +61 -0
- data/lib/aspose_cad_cloud/models/requests/MoveFolderRequest.rb +57 -0
- data/lib/aspose_cad_cloud/models/requests/ObjectExistsRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/requests/PostDrawingRotateFlipRequest.rb +2 -2
- data/lib/aspose_cad_cloud/models/requests/StorageExistsRequest.rb +45 -0
- data/lib/aspose_cad_cloud/models/requests/UploadFileRequest.rb +53 -0
- data/lib/aspose_cad_cloud/models/resolution_setting.rb +1 -3
- data/lib/aspose_cad_cloud/models/storage_exist.rb +212 -0
- data/lib/aspose_cad_cloud/models/storage_file.rb +257 -0
- data/lib/aspose_cad_cloud/version.rb +1 -1
- metadata +36 -31
@@ -276,7 +276,8 @@ module AsposeCadCloud
|
|
276
276
|
def build_request_url(path)
|
277
277
|
# Add leading and trailing slashes to path
|
278
278
|
path = "/#{path}".gsub(/\/+/, '/')
|
279
|
-
URI.
|
279
|
+
req = URI::Parser.new.escape @config.base_url + path
|
280
|
+
return req
|
280
281
|
end
|
281
282
|
|
282
283
|
# Builds the HTTP request body
|
@@ -40,9 +40,6 @@ module AsposeCadCloud
|
|
40
40
|
# Defines v3 api version
|
41
41
|
V3_API_VERSION = '/v3.0'.freeze
|
42
42
|
|
43
|
-
# Defines v1.1 api version
|
44
|
-
V1_1_API_VERSION = '/v1.1'.freeze
|
45
|
-
|
46
43
|
# Defines url scheme
|
47
44
|
attr_accessor :scheme
|
48
45
|
|
@@ -155,7 +152,7 @@ module AsposeCadCloud
|
|
155
152
|
# returns base url
|
156
153
|
def base_url
|
157
154
|
url = "#{scheme}://#{[host, api_version].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
158
|
-
URI.
|
155
|
+
return URI::Parser.new.escape url
|
159
156
|
end
|
160
157
|
|
161
158
|
# Gets API key (with prefix if set).
|
@@ -29,30 +29,22 @@ module AsposeCadCloud
|
|
29
29
|
# --------------------------------------------------------------------------------------------------------------------
|
30
30
|
#
|
31
31
|
|
32
|
-
|
32
|
+
|
33
33
|
class Color
|
34
|
-
# Gets the red component value of this Color structure.
|
35
34
|
attr_accessor :r
|
36
35
|
|
37
|
-
# Gets the green component value of this Color structure.
|
38
36
|
attr_accessor :g
|
39
37
|
|
40
|
-
# Gets the blue component value of this Color structure.
|
41
38
|
attr_accessor :b
|
42
39
|
|
43
|
-
# Gets the alpha component value of this Color structure.
|
44
40
|
attr_accessor :a
|
45
41
|
|
46
|
-
# Gets a value indicating whether this Color structure is a predefined color. Predefined colors are represented by the elements of the KnownColor enumeration.
|
47
42
|
attr_accessor :is_known_color
|
48
43
|
|
49
|
-
# Gets a value indicating whether this Color structure is uninitialized.
|
50
44
|
attr_accessor :is_empty
|
51
45
|
|
52
|
-
# Gets a value indicating whether this Color structure is a named color or a member of the KnownColor enumeration.
|
53
46
|
attr_accessor :is_named_color
|
54
47
|
|
55
|
-
# Gets the name of this Color.
|
56
48
|
attr_accessor :name
|
57
49
|
|
58
50
|
|
@@ -0,0 +1,227 @@
|
|
1
|
+
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module AsposeCadCloud
|
5
|
+
#
|
6
|
+
# --------------------------------------------------------------------------------------------------------------------
|
7
|
+
# <copyright company="Aspose" file="DiscUsage.rb">
|
8
|
+
# Copyright (c) 2017 Aspose.CAD Cloud
|
9
|
+
# </copyright>
|
10
|
+
# <summary>
|
11
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
# of this software and associated documentation files (the "Software"), to deal
|
13
|
+
# in the Software without restriction, including without limitation the rights
|
14
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of the Software, and to permit persons to whom the Software is
|
16
|
+
# furnished to do so, subject to the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be included in all
|
19
|
+
# copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
27
|
+
# SOFTWARE.
|
28
|
+
# </summary>
|
29
|
+
# --------------------------------------------------------------------------------------------------------------------
|
30
|
+
#
|
31
|
+
|
32
|
+
# Class for disc space information.
|
33
|
+
class DiscUsage
|
34
|
+
# Application used disc space.
|
35
|
+
attr_accessor :used_size
|
36
|
+
|
37
|
+
# Total disc space.
|
38
|
+
attr_accessor :total_size
|
39
|
+
|
40
|
+
|
41
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
42
|
+
def self.attribute_map
|
43
|
+
{
|
44
|
+
:'used_size' => :'UsedSize',
|
45
|
+
:'total_size' => :'TotalSize'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.swagger_types
|
51
|
+
{
|
52
|
+
:'used_size' => :'Integer',
|
53
|
+
:'total_size' => :'Integer'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Initializes the object
|
58
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
59
|
+
def initialize(attributes = {})
|
60
|
+
return unless attributes.is_a?(Hash)
|
61
|
+
|
62
|
+
# convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
64
|
+
|
65
|
+
if attributes.key?(:'UsedSize')
|
66
|
+
self.used_size = attributes[:'UsedSize']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'TotalSize')
|
70
|
+
self.total_size = attributes[:'TotalSize']
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properies with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = []
|
79
|
+
if @used_size.nil?
|
80
|
+
invalid_properties.push("invalid value for 'used_size', used_size cannot be nil.")
|
81
|
+
end
|
82
|
+
|
83
|
+
if @total_size.nil?
|
84
|
+
invalid_properties.push("invalid value for 'total_size', total_size cannot be nil.")
|
85
|
+
end
|
86
|
+
|
87
|
+
return invalid_properties
|
88
|
+
end
|
89
|
+
|
90
|
+
# Check to see if the all the properties in the model are valid
|
91
|
+
# @return true if the model is valid
|
92
|
+
def valid?
|
93
|
+
return false if @used_size.nil?
|
94
|
+
return false if @total_size.nil?
|
95
|
+
return true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Checks equality by comparing each attribute.
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def ==(other)
|
101
|
+
return true if self.equal?(other)
|
102
|
+
self.class == other.class &&
|
103
|
+
used_size == other.used_size &&
|
104
|
+
total_size == other.total_size
|
105
|
+
end
|
106
|
+
|
107
|
+
# @see the `==` method
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def eql?(other)
|
110
|
+
self == other
|
111
|
+
end
|
112
|
+
|
113
|
+
# Calculates hash code according to all attributes.
|
114
|
+
# @return [Fixnum] Hash code
|
115
|
+
def hash
|
116
|
+
[used_size, total_size].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.swagger_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end
|
134
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :DateTime
|
147
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
148
|
+
when :Date
|
149
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :BOOLEAN
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else
|
177
|
+
# model
|
178
|
+
temp_model = AsposeCadCloud.const_get(type).new
|
179
|
+
temp_model.build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
next if value.nil?
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
module AsposeCadCloud
|
5
|
+
#
|
6
|
+
# --------------------------------------------------------------------------------------------------------------------
|
7
|
+
# <copyright company="Aspose" file="Error.rb">
|
8
|
+
# Copyright (c) 2017 Aspose.CAD Cloud
|
9
|
+
# </copyright>
|
10
|
+
# <summary>
|
11
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
12
|
+
# of this software and associated documentation files (the "Software"), to deal
|
13
|
+
# in the Software without restriction, including without limitation the rights
|
14
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
15
|
+
# copies of the Software, and to permit persons to whom the Software is
|
16
|
+
# furnished to do so, subject to the following conditions:
|
17
|
+
#
|
18
|
+
# The above copyright notice and this permission notice shall be included in all
|
19
|
+
# copies or substantial portions of the Software.
|
20
|
+
#
|
21
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
26
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
27
|
+
# SOFTWARE.
|
28
|
+
# </summary>
|
29
|
+
# --------------------------------------------------------------------------------------------------------------------
|
30
|
+
#
|
31
|
+
|
32
|
+
# Error
|
33
|
+
class Error
|
34
|
+
# Code
|
35
|
+
attr_accessor :code
|
36
|
+
|
37
|
+
# Message
|
38
|
+
attr_accessor :message
|
39
|
+
|
40
|
+
# Description
|
41
|
+
attr_accessor :description
|
42
|
+
|
43
|
+
# Inner Error
|
44
|
+
attr_accessor :inner_error
|
45
|
+
|
46
|
+
|
47
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
48
|
+
def self.attribute_map
|
49
|
+
{
|
50
|
+
:'code' => :'Code',
|
51
|
+
:'message' => :'Message',
|
52
|
+
:'description' => :'Description',
|
53
|
+
:'inner_error' => :'InnerError'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.swagger_types
|
59
|
+
{
|
60
|
+
:'code' => :'String',
|
61
|
+
:'message' => :'String',
|
62
|
+
:'description' => :'String',
|
63
|
+
:'inner_error' => :'ErrorDetails'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Initializes the object
|
68
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
69
|
+
def initialize(attributes = {})
|
70
|
+
return unless attributes.is_a?(Hash)
|
71
|
+
|
72
|
+
# convert string to symbol for hash key
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
74
|
+
|
75
|
+
if attributes.key?(:'Code')
|
76
|
+
self.code = attributes[:'Code']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'Message')
|
80
|
+
self.message = attributes[:'Message']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'Description')
|
84
|
+
self.description = attributes[:'Description']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'InnerError')
|
88
|
+
self.inner_error = attributes[:'InnerError']
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properies with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = []
|
97
|
+
return invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
return true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(other)
|
109
|
+
return true if self.equal?(other)
|
110
|
+
self.class == other.class &&
|
111
|
+
code == other.code &&
|
112
|
+
message == other.message &&
|
113
|
+
description == other.description &&
|
114
|
+
inner_error == other.inner_error
|
115
|
+
end
|
116
|
+
|
117
|
+
# @see the `==` method
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def eql?(other)
|
120
|
+
self == other
|
121
|
+
end
|
122
|
+
|
123
|
+
# Calculates hash code according to all attributes.
|
124
|
+
# @return [Fixnum] Hash code
|
125
|
+
def hash
|
126
|
+
[code, message, description, inner_error].hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# Builds the object from hash
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
131
|
+
# @return [Object] Returns the model itself
|
132
|
+
def build_from_hash(attributes)
|
133
|
+
return nil unless attributes.is_a?(Hash)
|
134
|
+
self.class.swagger_types.each_pair do |key, type|
|
135
|
+
if type =~ /\AArray<(.*)>/i
|
136
|
+
# check to ensure the input is an array given that the the attribute
|
137
|
+
# is documented as an array but the input is not
|
138
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
139
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
140
|
+
end
|
141
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
142
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
143
|
+
end
|
144
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
145
|
+
end
|
146
|
+
|
147
|
+
self
|
148
|
+
end
|
149
|
+
|
150
|
+
# Deserializes the data based on type
|
151
|
+
# @param string type Data type
|
152
|
+
# @param string value Value to be deserialized
|
153
|
+
# @return [Object] Deserialized data
|
154
|
+
def _deserialize(type, value)
|
155
|
+
case type.to_sym
|
156
|
+
when :DateTime
|
157
|
+
Time.at(/\d/.match(value)[0].to_f).to_datetime
|
158
|
+
when :Date
|
159
|
+
Time.at(/\d/.match(value)[0].to_f).to_date
|
160
|
+
when :String
|
161
|
+
value.to_s
|
162
|
+
when :Integer
|
163
|
+
value.to_i
|
164
|
+
when :Float
|
165
|
+
value.to_f
|
166
|
+
when :BOOLEAN
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
when :Object
|
173
|
+
# generic object (usually a Hash), return directly
|
174
|
+
value
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
181
|
+
{}.tap do |hash|
|
182
|
+
value.each do |k, v|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
else
|
187
|
+
# model
|
188
|
+
temp_model = AsposeCadCloud.const_get(type).new
|
189
|
+
temp_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
next if value.nil?
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
end
|