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,308 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="join_item.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 document for join operation
|
32
|
+
class JoinItem
|
33
|
+
|
34
|
+
# File info
|
35
|
+
attr_accessor :file_info
|
36
|
+
|
37
|
+
# List of page numbers to use in a Join operation. NOTE: page numbering starts from 1.
|
38
|
+
attr_accessor :pages
|
39
|
+
|
40
|
+
# Start page number. Ignored if Pages collection is not empty.
|
41
|
+
attr_accessor :start_page_number
|
42
|
+
|
43
|
+
# End page number. Ignored if Pages collection is not empty.
|
44
|
+
attr_accessor :end_page_number
|
45
|
+
|
46
|
+
# Range mode. Ignored if Pages collection is not empty. Default value is AllPages.
|
47
|
+
attr_accessor :range_mode
|
48
|
+
class EnumAttributeValidator
|
49
|
+
attr_reader :datatype
|
50
|
+
attr_reader :allowable_values
|
51
|
+
|
52
|
+
def initialize(datatype, allowable_values)
|
53
|
+
@allowable_values = allowable_values.map do |value|
|
54
|
+
case datatype.to_s
|
55
|
+
when /Integer/i
|
56
|
+
value.to_i
|
57
|
+
when /Float/i
|
58
|
+
value.to_f
|
59
|
+
else
|
60
|
+
value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def valid?(value)
|
66
|
+
!value || allowable_values.include?(value)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
71
|
+
def self.attribute_map
|
72
|
+
{
|
73
|
+
:'file_info' => :'FileInfo',
|
74
|
+
:'pages' => :'Pages',
|
75
|
+
:'start_page_number' => :'StartPageNumber',
|
76
|
+
:'end_page_number' => :'EndPageNumber',
|
77
|
+
:'range_mode' => :'RangeMode'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# Attribute type mapping.
|
82
|
+
def self.swagger_types
|
83
|
+
{
|
84
|
+
:'file_info' => :'FileInfo',
|
85
|
+
:'pages' => :'Array<Integer>',
|
86
|
+
:'start_page_number' => :'Integer',
|
87
|
+
:'end_page_number' => :'Integer',
|
88
|
+
:'range_mode' => :'String'
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
# Initializes the object
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
94
|
+
def initialize(attributes = {})
|
95
|
+
return unless attributes.is_a?(Hash)
|
96
|
+
|
97
|
+
# convert string to symbol for hash key
|
98
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
99
|
+
|
100
|
+
if attributes.key?(:'FileInfo')
|
101
|
+
self.file_info = attributes[:'FileInfo']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.key?(:'Pages')
|
105
|
+
if (value = attributes[:'Pages']).is_a?(Array)
|
106
|
+
self.pages = value
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'StartPageNumber')
|
111
|
+
self.start_page_number = attributes[:'StartPageNumber']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'EndPageNumber')
|
115
|
+
self.end_page_number = attributes[:'EndPageNumber']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'RangeMode')
|
119
|
+
self.range_mode = attributes[:'RangeMode']
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properies with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = []
|
128
|
+
if @start_page_number.nil?
|
129
|
+
invalid_properties.push("invalid value for 'start_page_number', start_page_number cannot be nil.")
|
130
|
+
end
|
131
|
+
|
132
|
+
if @end_page_number.nil?
|
133
|
+
invalid_properties.push("invalid value for 'end_page_number', end_page_number cannot be nil.")
|
134
|
+
end
|
135
|
+
|
136
|
+
if @range_mode.nil?
|
137
|
+
invalid_properties.push("invalid value for 'range_mode', range_mode cannot be nil.")
|
138
|
+
end
|
139
|
+
|
140
|
+
return invalid_properties
|
141
|
+
end
|
142
|
+
|
143
|
+
# Check to see if the all the properties in the model are valid
|
144
|
+
# @return true if the model is valid
|
145
|
+
def valid?
|
146
|
+
return false if @start_page_number.nil?
|
147
|
+
return false if @end_page_number.nil?
|
148
|
+
return false if @range_mode.nil?
|
149
|
+
range_mode_validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
|
150
|
+
return false unless range_mode_validator.valid?(@range_mode)
|
151
|
+
return true
|
152
|
+
end
|
153
|
+
|
154
|
+
# Custom attribute writer method checking allowed values (enum).
|
155
|
+
# @param [Object] range_mode Object to be assigned
|
156
|
+
def range_mode=(range_mode)
|
157
|
+
validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
|
158
|
+
if range_mode.to_i == 0
|
159
|
+
unless validator.valid?(range_mode)
|
160
|
+
raise ArgumentError, "invalid value for 'range_mode', must be one of #{validator.allowable_values}."
|
161
|
+
end
|
162
|
+
@range_mode = range_mode
|
163
|
+
else
|
164
|
+
@range_mode = validator.allowable_values[range_mode.to_i]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Checks equality by comparing each attribute.
|
169
|
+
# @param [Object] Object to be compared
|
170
|
+
def ==(other)
|
171
|
+
return true if self.equal?(other)
|
172
|
+
self.class == other.class &&
|
173
|
+
file_info == other.file_info &&
|
174
|
+
pages == other.pages &&
|
175
|
+
start_page_number == other.start_page_number &&
|
176
|
+
end_page_number == other.end_page_number &&
|
177
|
+
range_mode == other.range_mode
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def eql?(other)
|
183
|
+
self == other
|
184
|
+
end
|
185
|
+
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Fixnum] Hash code
|
188
|
+
def hash
|
189
|
+
[file_info, pages, start_page_number, end_page_number, range_mode].hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Downcases first letter.
|
193
|
+
# @return downcased string
|
194
|
+
def uncap(str)
|
195
|
+
str[0, 1].downcase + str[1..-1]
|
196
|
+
end
|
197
|
+
|
198
|
+
# Builds the object from hash
|
199
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
200
|
+
# @return [Object] Returns the model itself
|
201
|
+
def build_from_hash(attributes)
|
202
|
+
return nil unless attributes.is_a?(Hash)
|
203
|
+
self.class.swagger_types.each_pair do |key, type|
|
204
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
205
|
+
value = attributes[pname]
|
206
|
+
if type =~ /\AArray<(.*)>/i
|
207
|
+
# check to ensure the input is an array given that the the attribute
|
208
|
+
# is documented as an array but the input is not
|
209
|
+
if value.is_a?(Array)
|
210
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
211
|
+
end
|
212
|
+
elsif !value.nil?
|
213
|
+
self.send("#{key}=", _deserialize(type, value))
|
214
|
+
end
|
215
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
216
|
+
end
|
217
|
+
|
218
|
+
self
|
219
|
+
end
|
220
|
+
|
221
|
+
# Deserializes the data based on type
|
222
|
+
# @param string type Data type
|
223
|
+
# @param string value Value to be deserialized
|
224
|
+
# @return [Object] Deserialized data
|
225
|
+
def _deserialize(type, value)
|
226
|
+
case type.to_sym
|
227
|
+
when :DateTime
|
228
|
+
Date.parse value
|
229
|
+
when :Date
|
230
|
+
Date.parse value
|
231
|
+
when :String
|
232
|
+
value.to_s
|
233
|
+
when :Integer
|
234
|
+
value.to_i
|
235
|
+
when :Float
|
236
|
+
value.to_f
|
237
|
+
when :BOOLEAN
|
238
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
239
|
+
true
|
240
|
+
else
|
241
|
+
false
|
242
|
+
end
|
243
|
+
when :Object
|
244
|
+
# generic object (usually a Hash), return directly
|
245
|
+
value
|
246
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
247
|
+
inner_type = Regexp.last_match[:inner_type]
|
248
|
+
value.map { |v| _deserialize(inner_type, v) }
|
249
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
250
|
+
k_type = Regexp.last_match[:k_type]
|
251
|
+
v_type = Regexp.last_match[:v_type]
|
252
|
+
{}.tap do |hash|
|
253
|
+
value.each do |k, v|
|
254
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
else
|
258
|
+
# model
|
259
|
+
temp_model = GroupDocsMergerCloud.const_get(type).new
|
260
|
+
temp_model.build_from_hash(value)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# Returns the string representation of the object
|
265
|
+
# @return [String] String presentation of the object
|
266
|
+
def to_s
|
267
|
+
to_hash.to_s
|
268
|
+
end
|
269
|
+
|
270
|
+
# to_body is an alias to to_hash (backward compatibility)
|
271
|
+
# @return [Hash] Returns the object in the form of hash
|
272
|
+
def to_body
|
273
|
+
to_hash
|
274
|
+
end
|
275
|
+
|
276
|
+
# Returns the object in the form of hash
|
277
|
+
# @return [Hash] Returns the object in the form of hash
|
278
|
+
def to_hash
|
279
|
+
hash = {}
|
280
|
+
self.class.attribute_map.each_pair do |attr, param|
|
281
|
+
value = self.send(attr)
|
282
|
+
next if value.nil?
|
283
|
+
hash[param] = _to_hash(value)
|
284
|
+
end
|
285
|
+
hash
|
286
|
+
end
|
287
|
+
|
288
|
+
# Outputs non-array value in the form of hash
|
289
|
+
# For object, use to_hash. Otherwise, just return the value
|
290
|
+
# @param [Object] value Any valid value
|
291
|
+
# @return [Hash] Returns the value in the form of hash
|
292
|
+
def _to_hash(value)
|
293
|
+
if value.is_a?(Array)
|
294
|
+
value.compact.map { |v| _to_hash(v) }
|
295
|
+
elsif value.is_a?(Hash)
|
296
|
+
{}.tap do |hash|
|
297
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
298
|
+
end
|
299
|
+
elsif value.respond_to? :to_hash
|
300
|
+
value.to_hash
|
301
|
+
else
|
302
|
+
value
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
#
|
2
|
+
# --------------------------------------------------------------------------------------------------------------------
|
3
|
+
# <copyright company="Aspose Pty Ltd" file="join_options.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
|
+
# Defines options for documents Join method
|
32
|
+
class JoinOptions
|
33
|
+
|
34
|
+
# Documents descriptions for Join operation
|
35
|
+
attr_accessor :join_items
|
36
|
+
|
37
|
+
# The output path
|
38
|
+
attr_accessor :output_path
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'join_items' => :'JoinItems',
|
44
|
+
:'output_path' => :'OutputPath'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'join_items' => :'Array<JoinItem>',
|
52
|
+
:'output_path' => :'String'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Initializes the object
|
57
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
58
|
+
def initialize(attributes = {})
|
59
|
+
return unless attributes.is_a?(Hash)
|
60
|
+
|
61
|
+
# convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
63
|
+
|
64
|
+
if attributes.key?(:'JoinItems')
|
65
|
+
if (value = attributes[:'JoinItems']).is_a?(Array)
|
66
|
+
self.join_items = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'OutputPath')
|
71
|
+
self.output_path = attributes[:'OutputPath']
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
77
|
+
# @return Array for valid properies with the reasons
|
78
|
+
def list_invalid_properties
|
79
|
+
invalid_properties = []
|
80
|
+
return invalid_properties
|
81
|
+
end
|
82
|
+
|
83
|
+
# Check to see if the all the properties in the model are valid
|
84
|
+
# @return true if the model is valid
|
85
|
+
def valid?
|
86
|
+
return true
|
87
|
+
end
|
88
|
+
|
89
|
+
# Checks equality by comparing each attribute.
|
90
|
+
# @param [Object] Object to be compared
|
91
|
+
def ==(other)
|
92
|
+
return true if self.equal?(other)
|
93
|
+
self.class == other.class &&
|
94
|
+
join_items == other.join_items &&
|
95
|
+
output_path == other.output_path
|
96
|
+
end
|
97
|
+
|
98
|
+
# @see the `==` method
|
99
|
+
# @param [Object] Object to be compared
|
100
|
+
def eql?(other)
|
101
|
+
self == other
|
102
|
+
end
|
103
|
+
|
104
|
+
# Calculates hash code according to all attributes.
|
105
|
+
# @return [Fixnum] Hash code
|
106
|
+
def hash
|
107
|
+
[join_items, output_path].hash
|
108
|
+
end
|
109
|
+
|
110
|
+
# Downcases first letter.
|
111
|
+
# @return downcased string
|
112
|
+
def uncap(str)
|
113
|
+
str[0, 1].downcase + str[1..-1]
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
pname = uncap(self.class.attribute_map[key]).intern
|
123
|
+
value = attributes[pname]
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if value.is_a?(Array)
|
128
|
+
self.send("#{key}=", value.map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !value.nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, value))
|
132
|
+
end
|
133
|
+
# or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
Date.parse value
|
147
|
+
when :Date
|
148
|
+
Date.parse value
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :BOOLEAN
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else
|
176
|
+
# model
|
177
|
+
temp_model = GroupDocsMergerCloud.const_get(type).new
|
178
|
+
temp_model.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
next if value.nil?
|
201
|
+
hash[param] = _to_hash(value)
|
202
|
+
end
|
203
|
+
hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# Outputs non-array value in the form of hash
|
207
|
+
# For object, use to_hash. Otherwise, just return the value
|
208
|
+
# @param [Object] value Any valid value
|
209
|
+
# @return [Hash] Returns the value in the form of hash
|
210
|
+
def _to_hash(value)
|
211
|
+
if value.is_a?(Array)
|
212
|
+
value.compact.map { |v| _to_hash(v) }
|
213
|
+
elsif value.is_a?(Hash)
|
214
|
+
{}.tap do |hash|
|
215
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
216
|
+
end
|
217
|
+
elsif value.respond_to? :to_hash
|
218
|
+
value.to_hash
|
219
|
+
else
|
220
|
+
value
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|