groupdocs_merger_cloud 19.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/groupdocs_merger_cloud.rb +72 -0
- data/lib/groupdocs_merger_cloud/api/document_api.rb +411 -0
- data/lib/groupdocs_merger_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_merger_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_merger_cloud/api/info_api.rb +266 -0
- data/lib/groupdocs_merger_cloud/api/pages_api.rb +702 -0
- data/lib/groupdocs_merger_cloud/api/security_api.rb +528 -0
- data/lib/groupdocs_merger_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_merger_cloud/api_client.rb +380 -0
- data/lib/groupdocs_merger_cloud/api_error.rb +58 -0
- data/lib/groupdocs_merger_cloud/configuration.rb +95 -0
- data/lib/groupdocs_merger_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_merger_cloud/models/document_result.rb +214 -0
- data/lib/groupdocs_merger_cloud/models/error.rb +244 -0
- data/lib/groupdocs_merger_cloud/models/error_details.rb +229 -0
- data/lib/groupdocs_merger_cloud/models/extract_options.rb +318 -0
- data/lib/groupdocs_merger_cloud/models/file_info.rb +244 -0
- data/lib/groupdocs_merger_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_merger_cloud/models/file_versions.rb +216 -0
- data/lib/groupdocs_merger_cloud/models/files_list.rb +216 -0
- data/lib/groupdocs_merger_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_merger_cloud/models/format.rb +224 -0
- data/lib/groupdocs_merger_cloud/models/formats_result.rb +216 -0
- data/lib/groupdocs_merger_cloud/models/info_result.rb +251 -0
- data/lib/groupdocs_merger_cloud/models/join_item.rb +308 -0
- data/lib/groupdocs_merger_cloud/models/join_options.rb +226 -0
- data/lib/groupdocs_merger_cloud/models/move_options.rb +254 -0
- data/lib/groupdocs_merger_cloud/models/multi_document_result.rb +216 -0
- data/lib/groupdocs_merger_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_merger_cloud/models/options.rb +224 -0
- data/lib/groupdocs_merger_cloud/models/orientation_options.rb +349 -0
- data/lib/groupdocs_merger_cloud/models/page_info.rb +264 -0
- data/lib/groupdocs_merger_cloud/models/page_options.rb +318 -0
- data/lib/groupdocs_merger_cloud/models/password_result.rb +219 -0
- data/lib/groupdocs_merger_cloud/models/preview_options.rb +379 -0
- data/lib/groupdocs_merger_cloud/models/remove_options.rb +318 -0
- data/lib/groupdocs_merger_cloud/models/rotate_options.rb +349 -0
- data/lib/groupdocs_merger_cloud/models/split_options.rb +349 -0
- data/lib/groupdocs_merger_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_merger_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_merger_cloud/models/swap_options.rb +254 -0
- data/lib/groupdocs_merger_cloud/models/update_password_options.rb +234 -0
- data/lib/groupdocs_merger_cloud/version.rb +29 -0
- metadata +155 -0
@@ -0,0 +1,244 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="file_info.rb">
|
4
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsMergerCloud
|
31
|
+
# Describes file properties
|
32
|
+
class FileInfo
|
33
|
+
|
34
|
+
# File path in storage
|
35
|
+
attr_accessor :file_path
|
36
|
+
|
37
|
+
# Storage name
|
38
|
+
attr_accessor :storage_name
|
39
|
+
|
40
|
+
# Version ID
|
41
|
+
attr_accessor :version_id
|
42
|
+
|
43
|
+
# Password to open file
|
44
|
+
attr_accessor :password
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'file_path' => :'FilePath',
|
50
|
+
:'storage_name' => :'StorageName',
|
51
|
+
:'version_id' => :'VersionId',
|
52
|
+
:'password' => :'Password'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'file_path' => :'String',
|
60
|
+
:'storage_name' => :'String',
|
61
|
+
:'version_id' => :'String',
|
62
|
+
:'password' => :'String'
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
return unless attributes.is_a?(Hash)
|
70
|
+
|
71
|
+
# convert string to symbol for hash key
|
72
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
73
|
+
|
74
|
+
if attributes.key?(:'FilePath')
|
75
|
+
self.file_path = attributes[:'FilePath']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.key?(:'StorageName')
|
79
|
+
self.storage_name = attributes[:'StorageName']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.key?(:'VersionId')
|
83
|
+
self.version_id = attributes[:'VersionId']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'Password')
|
87
|
+
self.password = attributes[:'Password']
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properies with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = []
|
96
|
+
return invalid_properties
|
97
|
+
end
|
98
|
+
|
99
|
+
# Check to see if the all the properties in the model are valid
|
100
|
+
# @return true if the model is valid
|
101
|
+
def valid?
|
102
|
+
return true
|
103
|
+
end
|
104
|
+
|
105
|
+
# Checks equality by comparing each attribute.
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def ==(other)
|
108
|
+
return true if self.equal?(other)
|
109
|
+
self.class == other.class &&
|
110
|
+
file_path == other.file_path &&
|
111
|
+
storage_name == other.storage_name &&
|
112
|
+
version_id == other.version_id &&
|
113
|
+
password == other.password
|
114
|
+
end
|
115
|
+
|
116
|
+
# @see the `==` method
|
117
|
+
# @param [Object] Object to be compared
|
118
|
+
def eql?(other)
|
119
|
+
self == other
|
120
|
+
end
|
121
|
+
|
122
|
+
# Calculates hash code according to all attributes.
|
123
|
+
# @return [Fixnum] Hash code
|
124
|
+
def hash
|
125
|
+
[file_path, storage_name, version_id, password].hash
|
126
|
+
end
|
127
|
+
|
128
|
+
# Downcases first letter.
|
129
|
+
# @return downcased string
|
130
|
+
def uncap(str)
|
131
|
+
str[0, 1].downcase + str[1..-1]
|
132
|
+
end
|
133
|
+
|
134
|
+
# Builds the object from hash
|
135
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
136
|
+
# @return [Object] Returns the model itself
|
137
|
+
def build_from_hash(attributes)
|
138
|
+
return nil unless attributes.is_a?(Hash)
|
139
|
+
self.class.swagger_types.each_pair do |key, type|
|
140
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
141
|
+
value = attributes[pname]
|
142
|
+
if type =~ /\AArray<(.*)>/i
|
143
|
+
# check to ensure the input is an array given that the the attribute
|
144
|
+
# is documented as an array but the input is not
|
145
|
+
if value.is_a?(Array)
|
146
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
147
|
+
end
|
148
|
+
elsif !value.nil?
|
149
|
+
self.send("#{key}=", _deserialize(type, value))
|
150
|
+
end
|
151
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
152
|
+
end
|
153
|
+
|
154
|
+
self
|
155
|
+
end
|
156
|
+
|
157
|
+
# Deserializes the data based on type
|
158
|
+
# @param string type Data type
|
159
|
+
# @param string value Value to be deserialized
|
160
|
+
# @return [Object] Deserialized data
|
161
|
+
def _deserialize(type, value)
|
162
|
+
case type.to_sym
|
163
|
+
when :DateTime
|
164
|
+
Date.parse value
|
165
|
+
when :Date
|
166
|
+
Date.parse value
|
167
|
+
when :String
|
168
|
+
value.to_s
|
169
|
+
when :Integer
|
170
|
+
value.to_i
|
171
|
+
when :Float
|
172
|
+
value.to_f
|
173
|
+
when :BOOLEAN
|
174
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
175
|
+
true
|
176
|
+
else
|
177
|
+
false
|
178
|
+
end
|
179
|
+
when :Object
|
180
|
+
# generic object (usually a Hash), return directly
|
181
|
+
value
|
182
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
183
|
+
inner_type = Regexp.last_match[:inner_type]
|
184
|
+
value.map { |v| _deserialize(inner_type, v) }
|
185
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
186
|
+
k_type = Regexp.last_match[:k_type]
|
187
|
+
v_type = Regexp.last_match[:v_type]
|
188
|
+
{}.tap do |hash|
|
189
|
+
value.each do |k, v|
|
190
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
else
|
194
|
+
# model
|
195
|
+
temp_model = GroupDocsMergerCloud.const_get(type).new
|
196
|
+
temp_model.build_from_hash(value)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Returns the string representation of the object
|
201
|
+
# @return [String] String presentation of the object
|
202
|
+
def to_s
|
203
|
+
to_hash.to_s
|
204
|
+
end
|
205
|
+
|
206
|
+
# to_body is an alias to to_hash (backward compatibility)
|
207
|
+
# @return [Hash] Returns the object in the form of hash
|
208
|
+
def to_body
|
209
|
+
to_hash
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns the object in the form of hash
|
213
|
+
# @return [Hash] Returns the object in the form of hash
|
214
|
+
def to_hash
|
215
|
+
hash = {}
|
216
|
+
self.class.attribute_map.each_pair do |attr, param|
|
217
|
+
value = self.send(attr)
|
218
|
+
next if value.nil?
|
219
|
+
hash[param] = _to_hash(value)
|
220
|
+
end
|
221
|
+
hash
|
222
|
+
end
|
223
|
+
|
224
|
+
# Outputs non-array value in the form of hash
|
225
|
+
# For object, use to_hash. Otherwise, just return the value
|
226
|
+
# @param [Object] value Any valid value
|
227
|
+
# @return [Hash] Returns the value in the form of hash
|
228
|
+
def _to_hash(value)
|
229
|
+
if value.is_a?(Array)
|
230
|
+
value.compact.map { |v| _to_hash(v) }
|
231
|
+
elsif value.is_a?(Hash)
|
232
|
+
{}.tap do |hash|
|
233
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
234
|
+
end
|
235
|
+
elsif value.respond_to? :to_hash
|
236
|
+
value.to_hash
|
237
|
+
else
|
238
|
+
value
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
@@ -0,0 +1,289 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="file_version.rb">
|
4
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
5
|
+
# </copyright>
|
6
|
+
# <summary>
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
15
|
+
# copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
# SOFTWARE.
|
24
|
+
# </summary>
|
25
|
+
# --------------------------------------------------------------------------------------------------------------------
|
26
|
+
#
|
27
|
+
|
28
|
+
require 'date'
|
29
|
+
|
30
|
+
module GroupDocsMergerCloud
|
31
|
+
# File Version
|
32
|
+
class FileVersion
|
33
|
+
|
34
|
+
# File or folder name.
|
35
|
+
attr_accessor :name
|
36
|
+
|
37
|
+
# True if it is a folder.
|
38
|
+
attr_accessor :is_folder
|
39
|
+
|
40
|
+
# File or folder last modified DateTime.
|
41
|
+
attr_accessor :modified_date
|
42
|
+
|
43
|
+
# File or folder size.
|
44
|
+
attr_accessor :size
|
45
|
+
|
46
|
+
# File or folder path.
|
47
|
+
attr_accessor :path
|
48
|
+
|
49
|
+
# File Version ID.
|
50
|
+
attr_accessor :version_id
|
51
|
+
|
52
|
+
# Specifies whether the file is (true) or is not (false) the latest version of an file.
|
53
|
+
attr_accessor :is_latest
|
54
|
+
|
55
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
56
|
+
def self.attribute_map
|
57
|
+
{
|
58
|
+
:'name' => :'Name',
|
59
|
+
:'is_folder' => :'IsFolder',
|
60
|
+
:'modified_date' => :'ModifiedDate',
|
61
|
+
:'size' => :'Size',
|
62
|
+
:'path' => :'Path',
|
63
|
+
:'version_id' => :'VersionId',
|
64
|
+
:'is_latest' => :'IsLatest'
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
# Attribute type mapping.
|
69
|
+
def self.swagger_types
|
70
|
+
{
|
71
|
+
:'name' => :'String',
|
72
|
+
:'is_folder' => :'BOOLEAN',
|
73
|
+
:'modified_date' => :'DateTime',
|
74
|
+
:'size' => :'Integer',
|
75
|
+
:'path' => :'String',
|
76
|
+
:'version_id' => :'String',
|
77
|
+
:'is_latest' => :'BOOLEAN'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# Initializes the object
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
def initialize(attributes = {})
|
84
|
+
return unless attributes.is_a?(Hash)
|
85
|
+
|
86
|
+
# convert string to symbol for hash key
|
87
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
88
|
+
|
89
|
+
if attributes.key?(:'Name')
|
90
|
+
self.name = attributes[:'Name']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'IsFolder')
|
94
|
+
self.is_folder = attributes[:'IsFolder']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'ModifiedDate')
|
98
|
+
self.modified_date = attributes[:'ModifiedDate']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'Size')
|
102
|
+
self.size = attributes[:'Size']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'Path')
|
106
|
+
self.path = attributes[:'Path']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'VersionId')
|
110
|
+
self.version_id = attributes[:'VersionId']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'IsLatest')
|
114
|
+
self.is_latest = attributes[:'IsLatest']
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properies with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = []
|
123
|
+
if @is_folder.nil?
|
124
|
+
invalid_properties.push("invalid value for 'is_folder', is_folder cannot be nil.")
|
125
|
+
end
|
126
|
+
|
127
|
+
if @size.nil?
|
128
|
+
invalid_properties.push("invalid value for 'size', size cannot be nil.")
|
129
|
+
end
|
130
|
+
|
131
|
+
if @is_latest.nil?
|
132
|
+
invalid_properties.push("invalid value for 'is_latest', is_latest cannot be nil.")
|
133
|
+
end
|
134
|
+
|
135
|
+
return invalid_properties
|
136
|
+
end
|
137
|
+
|
138
|
+
# Check to see if the all the properties in the model are valid
|
139
|
+
# @return true if the model is valid
|
140
|
+
def valid?
|
141
|
+
return false if @is_folder.nil?
|
142
|
+
return false if @size.nil?
|
143
|
+
return false if @is_latest.nil?
|
144
|
+
return true
|
145
|
+
end
|
146
|
+
|
147
|
+
# Checks equality by comparing each attribute.
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def ==(other)
|
150
|
+
return true if self.equal?(other)
|
151
|
+
self.class == other.class &&
|
152
|
+
name == other.name &&
|
153
|
+
is_folder == other.is_folder &&
|
154
|
+
modified_date == other.modified_date &&
|
155
|
+
size == other.size &&
|
156
|
+
path == other.path &&
|
157
|
+
version_id == other.version_id &&
|
158
|
+
is_latest == other.is_latest
|
159
|
+
end
|
160
|
+
|
161
|
+
# @see the `==` method
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def eql?(other)
|
164
|
+
self == other
|
165
|
+
end
|
166
|
+
|
167
|
+
# Calculates hash code according to all attributes.
|
168
|
+
# @return [Fixnum] Hash code
|
169
|
+
def hash
|
170
|
+
[name, is_folder, modified_date, size, path, version_id, is_latest].hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Downcases first letter.
|
174
|
+
# @return downcased string
|
175
|
+
def uncap(str)
|
176
|
+
str[0, 1].downcase + str[1..-1]
|
177
|
+
end
|
178
|
+
|
179
|
+
# Builds the object from hash
|
180
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
181
|
+
# @return [Object] Returns the model itself
|
182
|
+
def build_from_hash(attributes)
|
183
|
+
return nil unless attributes.is_a?(Hash)
|
184
|
+
self.class.swagger_types.each_pair do |key, type|
|
185
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
186
|
+
value = attributes[pname]
|
187
|
+
if type =~ /\AArray<(.*)>/i
|
188
|
+
# check to ensure the input is an array given that the the attribute
|
189
|
+
# is documented as an array but the input is not
|
190
|
+
if value.is_a?(Array)
|
191
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
192
|
+
end
|
193
|
+
elsif !value.nil?
|
194
|
+
self.send("#{key}=", _deserialize(type, value))
|
195
|
+
end
|
196
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
197
|
+
end
|
198
|
+
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Deserializes the data based on type
|
203
|
+
# @param string type Data type
|
204
|
+
# @param string value Value to be deserialized
|
205
|
+
# @return [Object] Deserialized data
|
206
|
+
def _deserialize(type, value)
|
207
|
+
case type.to_sym
|
208
|
+
when :DateTime
|
209
|
+
Date.parse value
|
210
|
+
when :Date
|
211
|
+
Date.parse value
|
212
|
+
when :String
|
213
|
+
value.to_s
|
214
|
+
when :Integer
|
215
|
+
value.to_i
|
216
|
+
when :Float
|
217
|
+
value.to_f
|
218
|
+
when :BOOLEAN
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
|
+
true
|
221
|
+
else
|
222
|
+
false
|
223
|
+
end
|
224
|
+
when :Object
|
225
|
+
# generic object (usually a Hash), return directly
|
226
|
+
value
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each do |k, v|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
else
|
239
|
+
# model
|
240
|
+
temp_model = GroupDocsMergerCloud.const_get(type).new
|
241
|
+
temp_model.build_from_hash(value)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns the string representation of the object
|
246
|
+
# @return [String] String presentation of the object
|
247
|
+
def to_s
|
248
|
+
to_hash.to_s
|
249
|
+
end
|
250
|
+
|
251
|
+
# to_body is an alias to to_hash (backward compatibility)
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_body
|
254
|
+
to_hash
|
255
|
+
end
|
256
|
+
|
257
|
+
# Returns the object in the form of hash
|
258
|
+
# @return [Hash] Returns the object in the form of hash
|
259
|
+
def to_hash
|
260
|
+
hash = {}
|
261
|
+
self.class.attribute_map.each_pair do |attr, param|
|
262
|
+
value = self.send(attr)
|
263
|
+
next if value.nil?
|
264
|
+
hash[param] = _to_hash(value)
|
265
|
+
end
|
266
|
+
hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Outputs non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
# @param [Object] value Any valid value
|
272
|
+
# @return [Hash] Returns the value in the form of hash
|
273
|
+
def _to_hash(value)
|
274
|
+
if value.is_a?(Array)
|
275
|
+
value.compact.map { |v| _to_hash(v) }
|
276
|
+
elsif value.is_a?(Hash)
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
279
|
+
end
|
280
|
+
elsif value.respond_to? :to_hash
|
281
|
+
value.to_hash
|
282
|
+
else
|
283
|
+
value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|