groupdocs_merger_cloud 19.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_merger_cloud.rb +72 -0
  3. data/lib/groupdocs_merger_cloud/api/document_api.rb +411 -0
  4. data/lib/groupdocs_merger_cloud/api/file_api.rb +729 -0
  5. data/lib/groupdocs_merger_cloud/api/folder_api.rb +694 -0
  6. data/lib/groupdocs_merger_cloud/api/info_api.rb +266 -0
  7. data/lib/groupdocs_merger_cloud/api/pages_api.rb +702 -0
  8. data/lib/groupdocs_merger_cloud/api/security_api.rb +528 -0
  9. data/lib/groupdocs_merger_cloud/api/storage_api.rb +541 -0
  10. data/lib/groupdocs_merger_cloud/api_client.rb +380 -0
  11. data/lib/groupdocs_merger_cloud/api_error.rb +58 -0
  12. data/lib/groupdocs_merger_cloud/configuration.rb +95 -0
  13. data/lib/groupdocs_merger_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_merger_cloud/models/document_result.rb +214 -0
  15. data/lib/groupdocs_merger_cloud/models/error.rb +244 -0
  16. data/lib/groupdocs_merger_cloud/models/error_details.rb +229 -0
  17. data/lib/groupdocs_merger_cloud/models/extract_options.rb +318 -0
  18. data/lib/groupdocs_merger_cloud/models/file_info.rb +244 -0
  19. data/lib/groupdocs_merger_cloud/models/file_version.rb +289 -0
  20. data/lib/groupdocs_merger_cloud/models/file_versions.rb +216 -0
  21. data/lib/groupdocs_merger_cloud/models/files_list.rb +216 -0
  22. data/lib/groupdocs_merger_cloud/models/files_upload_result.rb +228 -0
  23. data/lib/groupdocs_merger_cloud/models/format.rb +224 -0
  24. data/lib/groupdocs_merger_cloud/models/formats_result.rb +216 -0
  25. data/lib/groupdocs_merger_cloud/models/info_result.rb +251 -0
  26. data/lib/groupdocs_merger_cloud/models/join_item.rb +308 -0
  27. data/lib/groupdocs_merger_cloud/models/join_options.rb +226 -0
  28. data/lib/groupdocs_merger_cloud/models/move_options.rb +254 -0
  29. data/lib/groupdocs_merger_cloud/models/multi_document_result.rb +216 -0
  30. data/lib/groupdocs_merger_cloud/models/object_exist.rb +234 -0
  31. data/lib/groupdocs_merger_cloud/models/options.rb +224 -0
  32. data/lib/groupdocs_merger_cloud/models/orientation_options.rb +349 -0
  33. data/lib/groupdocs_merger_cloud/models/page_info.rb +264 -0
  34. data/lib/groupdocs_merger_cloud/models/page_options.rb +318 -0
  35. data/lib/groupdocs_merger_cloud/models/password_result.rb +219 -0
  36. data/lib/groupdocs_merger_cloud/models/preview_options.rb +379 -0
  37. data/lib/groupdocs_merger_cloud/models/remove_options.rb +318 -0
  38. data/lib/groupdocs_merger_cloud/models/rotate_options.rb +349 -0
  39. data/lib/groupdocs_merger_cloud/models/split_options.rb +349 -0
  40. data/lib/groupdocs_merger_cloud/models/storage_exist.rb +219 -0
  41. data/lib/groupdocs_merger_cloud/models/storage_file.rb +264 -0
  42. data/lib/groupdocs_merger_cloud/models/swap_options.rb +254 -0
  43. data/lib/groupdocs_merger_cloud/models/update_password_options.rb +234 -0
  44. data/lib/groupdocs_merger_cloud/version.rb +29 -0
  45. metadata +155 -0
@@ -0,0 +1,379 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="preview_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
+ # Represents document preview options
32
+ class PreviewOptions
33
+
34
+ # File info
35
+ attr_accessor :file_info
36
+
37
+ # The output path.
38
+ attr_accessor :output_path
39
+
40
+ # List of page numbers to use in a specific API method. NOTE: page numbering starts from 1.
41
+ attr_accessor :pages
42
+
43
+ # Start page number. Ignored if Pages collection is not empty.
44
+ attr_accessor :start_page_number
45
+
46
+ # End page number. Ignored if Pages collection is not empty.
47
+ attr_accessor :end_page_number
48
+
49
+ # Range mode. Ignored if Pages collection is not empty. Default value is AllPages.
50
+ attr_accessor :range_mode
51
+
52
+ # Preview width
53
+ attr_accessor :width
54
+
55
+ # Preview height
56
+ attr_accessor :height
57
+
58
+ # Preview image format
59
+ attr_accessor :format
60
+ class EnumAttributeValidator
61
+ attr_reader :datatype
62
+ attr_reader :allowable_values
63
+
64
+ def initialize(datatype, allowable_values)
65
+ @allowable_values = allowable_values.map do |value|
66
+ case datatype.to_s
67
+ when /Integer/i
68
+ value.to_i
69
+ when /Float/i
70
+ value.to_f
71
+ else
72
+ value
73
+ end
74
+ end
75
+ end
76
+
77
+ def valid?(value)
78
+ !value || allowable_values.include?(value)
79
+ end
80
+ end
81
+
82
+ # Attribute mapping from ruby-style variable name to JSON key.
83
+ def self.attribute_map
84
+ {
85
+ :'file_info' => :'FileInfo',
86
+ :'output_path' => :'OutputPath',
87
+ :'pages' => :'Pages',
88
+ :'start_page_number' => :'StartPageNumber',
89
+ :'end_page_number' => :'EndPageNumber',
90
+ :'range_mode' => :'RangeMode',
91
+ :'width' => :'Width',
92
+ :'height' => :'Height',
93
+ :'format' => :'Format'
94
+ }
95
+ end
96
+
97
+ # Attribute type mapping.
98
+ def self.swagger_types
99
+ {
100
+ :'file_info' => :'FileInfo',
101
+ :'output_path' => :'String',
102
+ :'pages' => :'Array<Integer>',
103
+ :'start_page_number' => :'Integer',
104
+ :'end_page_number' => :'Integer',
105
+ :'range_mode' => :'String',
106
+ :'width' => :'Integer',
107
+ :'height' => :'Integer',
108
+ :'format' => :'String'
109
+ }
110
+ end
111
+
112
+ # Initializes the object
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ def initialize(attributes = {})
115
+ return unless attributes.is_a?(Hash)
116
+
117
+ # convert string to symbol for hash key
118
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
119
+
120
+ if attributes.key?(:'FileInfo')
121
+ self.file_info = attributes[:'FileInfo']
122
+ end
123
+
124
+ if attributes.key?(:'OutputPath')
125
+ self.output_path = attributes[:'OutputPath']
126
+ end
127
+
128
+ if attributes.key?(:'Pages')
129
+ if (value = attributes[:'Pages']).is_a?(Array)
130
+ self.pages = value
131
+ end
132
+ end
133
+
134
+ if attributes.key?(:'StartPageNumber')
135
+ self.start_page_number = attributes[:'StartPageNumber']
136
+ end
137
+
138
+ if attributes.key?(:'EndPageNumber')
139
+ self.end_page_number = attributes[:'EndPageNumber']
140
+ end
141
+
142
+ if attributes.key?(:'RangeMode')
143
+ self.range_mode = attributes[:'RangeMode']
144
+ end
145
+
146
+ if attributes.key?(:'Width')
147
+ self.width = attributes[:'Width']
148
+ end
149
+
150
+ if attributes.key?(:'Height')
151
+ self.height = attributes[:'Height']
152
+ end
153
+
154
+ if attributes.key?(:'Format')
155
+ self.format = attributes[:'Format']
156
+ end
157
+
158
+ end
159
+
160
+ # Show invalid properties with the reasons. Usually used together with valid?
161
+ # @return Array for valid properies with the reasons
162
+ def list_invalid_properties
163
+ invalid_properties = []
164
+ if @start_page_number.nil?
165
+ invalid_properties.push("invalid value for 'start_page_number', start_page_number cannot be nil.")
166
+ end
167
+
168
+ if @end_page_number.nil?
169
+ invalid_properties.push("invalid value for 'end_page_number', end_page_number cannot be nil.")
170
+ end
171
+
172
+ if @range_mode.nil?
173
+ invalid_properties.push("invalid value for 'range_mode', range_mode cannot be nil.")
174
+ end
175
+
176
+ if @width.nil?
177
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
178
+ end
179
+
180
+ if @height.nil?
181
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
182
+ end
183
+
184
+ if @format.nil?
185
+ invalid_properties.push("invalid value for 'format', format cannot be nil.")
186
+ end
187
+
188
+ return invalid_properties
189
+ end
190
+
191
+ # Check to see if the all the properties in the model are valid
192
+ # @return true if the model is valid
193
+ def valid?
194
+ return false if @start_page_number.nil?
195
+ return false if @end_page_number.nil?
196
+ return false if @range_mode.nil?
197
+ range_mode_validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
198
+ return false unless range_mode_validator.valid?(@range_mode)
199
+ return false if @width.nil?
200
+ return false if @height.nil?
201
+ return false if @format.nil?
202
+ format_validator = EnumAttributeValidator.new('String', ["Jpeg", "Png", "Bmp"])
203
+ return false unless format_validator.valid?(@format)
204
+ return true
205
+ end
206
+
207
+ # Custom attribute writer method checking allowed values (enum).
208
+ # @param [Object] range_mode Object to be assigned
209
+ def range_mode=(range_mode)
210
+ validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
211
+ if range_mode.to_i == 0
212
+ unless validator.valid?(range_mode)
213
+ raise ArgumentError, "invalid value for 'range_mode', must be one of #{validator.allowable_values}."
214
+ end
215
+ @range_mode = range_mode
216
+ else
217
+ @range_mode = validator.allowable_values[range_mode.to_i]
218
+ end
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] format Object to be assigned
223
+ def format=(format)
224
+ validator = EnumAttributeValidator.new('String', ["Jpeg", "Png", "Bmp"])
225
+ if format.to_i == 0
226
+ unless validator.valid?(format)
227
+ raise ArgumentError, "invalid value for 'format', must be one of #{validator.allowable_values}."
228
+ end
229
+ @format = format
230
+ else
231
+ @format = validator.allowable_values[format.to_i]
232
+ end
233
+ end
234
+
235
+ # Checks equality by comparing each attribute.
236
+ # @param [Object] Object to be compared
237
+ def ==(other)
238
+ return true if self.equal?(other)
239
+ self.class == other.class &&
240
+ file_info == other.file_info &&
241
+ output_path == other.output_path &&
242
+ pages == other.pages &&
243
+ start_page_number == other.start_page_number &&
244
+ end_page_number == other.end_page_number &&
245
+ range_mode == other.range_mode &&
246
+ width == other.width &&
247
+ height == other.height &&
248
+ format == other.format
249
+ end
250
+
251
+ # @see the `==` method
252
+ # @param [Object] Object to be compared
253
+ def eql?(other)
254
+ self == other
255
+ end
256
+
257
+ # Calculates hash code according to all attributes.
258
+ # @return [Fixnum] Hash code
259
+ def hash
260
+ [file_info, output_path, pages, start_page_number, end_page_number, range_mode, width, height, format].hash
261
+ end
262
+
263
+ # Downcases first letter.
264
+ # @return downcased string
265
+ def uncap(str)
266
+ str[0, 1].downcase + str[1..-1]
267
+ end
268
+
269
+ # Builds the object from hash
270
+ # @param [Hash] attributes Model attributes in the form of hash
271
+ # @return [Object] Returns the model itself
272
+ def build_from_hash(attributes)
273
+ return nil unless attributes.is_a?(Hash)
274
+ self.class.swagger_types.each_pair do |key, type|
275
+ pname = uncap(self.class.attribute_map[key]).intern
276
+ value = attributes[pname]
277
+ if type =~ /\AArray<(.*)>/i
278
+ # check to ensure the input is an array given that the the attribute
279
+ # is documented as an array but the input is not
280
+ if value.is_a?(Array)
281
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
282
+ end
283
+ elsif !value.nil?
284
+ self.send("#{key}=", _deserialize(type, value))
285
+ end
286
+ # or else data not found in attributes(hash), not an issue as the data can be optional
287
+ end
288
+
289
+ self
290
+ end
291
+
292
+ # Deserializes the data based on type
293
+ # @param string type Data type
294
+ # @param string value Value to be deserialized
295
+ # @return [Object] Deserialized data
296
+ def _deserialize(type, value)
297
+ case type.to_sym
298
+ when :DateTime
299
+ Date.parse value
300
+ when :Date
301
+ Date.parse value
302
+ when :String
303
+ value.to_s
304
+ when :Integer
305
+ value.to_i
306
+ when :Float
307
+ value.to_f
308
+ when :BOOLEAN
309
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
310
+ true
311
+ else
312
+ false
313
+ end
314
+ when :Object
315
+ # generic object (usually a Hash), return directly
316
+ value
317
+ when /\AArray<(?<inner_type>.+)>\z/
318
+ inner_type = Regexp.last_match[:inner_type]
319
+ value.map { |v| _deserialize(inner_type, v) }
320
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
321
+ k_type = Regexp.last_match[:k_type]
322
+ v_type = Regexp.last_match[:v_type]
323
+ {}.tap do |hash|
324
+ value.each do |k, v|
325
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
326
+ end
327
+ end
328
+ else
329
+ # model
330
+ temp_model = GroupDocsMergerCloud.const_get(type).new
331
+ temp_model.build_from_hash(value)
332
+ end
333
+ end
334
+
335
+ # Returns the string representation of the object
336
+ # @return [String] String presentation of the object
337
+ def to_s
338
+ to_hash.to_s
339
+ end
340
+
341
+ # to_body is an alias to to_hash (backward compatibility)
342
+ # @return [Hash] Returns the object in the form of hash
343
+ def to_body
344
+ to_hash
345
+ end
346
+
347
+ # Returns the object in the form of hash
348
+ # @return [Hash] Returns the object in the form of hash
349
+ def to_hash
350
+ hash = {}
351
+ self.class.attribute_map.each_pair do |attr, param|
352
+ value = self.send(attr)
353
+ next if value.nil?
354
+ hash[param] = _to_hash(value)
355
+ end
356
+ hash
357
+ end
358
+
359
+ # Outputs non-array value in the form of hash
360
+ # For object, use to_hash. Otherwise, just return the value
361
+ # @param [Object] value Any valid value
362
+ # @return [Hash] Returns the value in the form of hash
363
+ def _to_hash(value)
364
+ if value.is_a?(Array)
365
+ value.compact.map { |v| _to_hash(v) }
366
+ elsif value.is_a?(Hash)
367
+ {}.tap do |hash|
368
+ value.each { |k, v| hash[k] = _to_hash(v) }
369
+ end
370
+ elsif value.respond_to? :to_hash
371
+ value.to_hash
372
+ else
373
+ value
374
+ end
375
+ end
376
+
377
+ end
378
+
379
+ end
@@ -0,0 +1,318 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="remove_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
+ # Remove pages options
32
+ class RemoveOptions
33
+
34
+ # File info
35
+ attr_accessor :file_info
36
+
37
+ # The output path.
38
+ attr_accessor :output_path
39
+
40
+ # List of page numbers to use in a specific API method. NOTE: page numbering starts from 1.
41
+ attr_accessor :pages
42
+
43
+ # Start page number. Ignored if Pages collection is not empty.
44
+ attr_accessor :start_page_number
45
+
46
+ # End page number. Ignored if Pages collection is not empty.
47
+ attr_accessor :end_page_number
48
+
49
+ # Range mode. Ignored if Pages collection is not empty. Default value is AllPages.
50
+ attr_accessor :range_mode
51
+ class EnumAttributeValidator
52
+ attr_reader :datatype
53
+ attr_reader :allowable_values
54
+
55
+ def initialize(datatype, allowable_values)
56
+ @allowable_values = allowable_values.map do |value|
57
+ case datatype.to_s
58
+ when /Integer/i
59
+ value.to_i
60
+ when /Float/i
61
+ value.to_f
62
+ else
63
+ value
64
+ end
65
+ end
66
+ end
67
+
68
+ def valid?(value)
69
+ !value || allowable_values.include?(value)
70
+ end
71
+ end
72
+
73
+ # Attribute mapping from ruby-style variable name to JSON key.
74
+ def self.attribute_map
75
+ {
76
+ :'file_info' => :'FileInfo',
77
+ :'output_path' => :'OutputPath',
78
+ :'pages' => :'Pages',
79
+ :'start_page_number' => :'StartPageNumber',
80
+ :'end_page_number' => :'EndPageNumber',
81
+ :'range_mode' => :'RangeMode'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'file_info' => :'FileInfo',
89
+ :'output_path' => :'String',
90
+ :'pages' => :'Array<Integer>',
91
+ :'start_page_number' => :'Integer',
92
+ :'end_page_number' => :'Integer',
93
+ :'range_mode' => :'String'
94
+ }
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ return unless attributes.is_a?(Hash)
101
+
102
+ # convert string to symbol for hash key
103
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
104
+
105
+ if attributes.key?(:'FileInfo')
106
+ self.file_info = attributes[:'FileInfo']
107
+ end
108
+
109
+ if attributes.key?(:'OutputPath')
110
+ self.output_path = attributes[:'OutputPath']
111
+ end
112
+
113
+ if attributes.key?(:'Pages')
114
+ if (value = attributes[:'Pages']).is_a?(Array)
115
+ self.pages = value
116
+ end
117
+ end
118
+
119
+ if attributes.key?(:'StartPageNumber')
120
+ self.start_page_number = attributes[:'StartPageNumber']
121
+ end
122
+
123
+ if attributes.key?(:'EndPageNumber')
124
+ self.end_page_number = attributes[:'EndPageNumber']
125
+ end
126
+
127
+ if attributes.key?(:'RangeMode')
128
+ self.range_mode = attributes[:'RangeMode']
129
+ end
130
+
131
+ end
132
+
133
+ # Show invalid properties with the reasons. Usually used together with valid?
134
+ # @return Array for valid properies with the reasons
135
+ def list_invalid_properties
136
+ invalid_properties = []
137
+ if @start_page_number.nil?
138
+ invalid_properties.push("invalid value for 'start_page_number', start_page_number cannot be nil.")
139
+ end
140
+
141
+ if @end_page_number.nil?
142
+ invalid_properties.push("invalid value for 'end_page_number', end_page_number cannot be nil.")
143
+ end
144
+
145
+ if @range_mode.nil?
146
+ invalid_properties.push("invalid value for 'range_mode', range_mode cannot be nil.")
147
+ end
148
+
149
+ return invalid_properties
150
+ end
151
+
152
+ # Check to see if the all the properties in the model are valid
153
+ # @return true if the model is valid
154
+ def valid?
155
+ return false if @start_page_number.nil?
156
+ return false if @end_page_number.nil?
157
+ return false if @range_mode.nil?
158
+ range_mode_validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
159
+ return false unless range_mode_validator.valid?(@range_mode)
160
+ return true
161
+ end
162
+
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] range_mode Object to be assigned
165
+ def range_mode=(range_mode)
166
+ validator = EnumAttributeValidator.new('String', ["AllPages", "OddPages", "EvenPages"])
167
+ if range_mode.to_i == 0
168
+ unless validator.valid?(range_mode)
169
+ raise ArgumentError, "invalid value for 'range_mode', must be one of #{validator.allowable_values}."
170
+ end
171
+ @range_mode = range_mode
172
+ else
173
+ @range_mode = validator.allowable_values[range_mode.to_i]
174
+ end
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(other)
180
+ return true if self.equal?(other)
181
+ self.class == other.class &&
182
+ file_info == other.file_info &&
183
+ output_path == other.output_path &&
184
+ pages == other.pages &&
185
+ start_page_number == other.start_page_number &&
186
+ end_page_number == other.end_page_number &&
187
+ range_mode == other.range_mode
188
+ end
189
+
190
+ # @see the `==` method
191
+ # @param [Object] Object to be compared
192
+ def eql?(other)
193
+ self == other
194
+ end
195
+
196
+ # Calculates hash code according to all attributes.
197
+ # @return [Fixnum] Hash code
198
+ def hash
199
+ [file_info, output_path, pages, start_page_number, end_page_number, range_mode].hash
200
+ end
201
+
202
+ # Downcases first letter.
203
+ # @return downcased string
204
+ def uncap(str)
205
+ str[0, 1].downcase + str[1..-1]
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ self.class.swagger_types.each_pair do |key, type|
214
+ pname = uncap(self.class.attribute_map[key]).intern
215
+ value = attributes[pname]
216
+ if type =~ /\AArray<(.*)>/i
217
+ # check to ensure the input is an array given that the the attribute
218
+ # is documented as an array but the input is not
219
+ if value.is_a?(Array)
220
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
221
+ end
222
+ elsif !value.nil?
223
+ self.send("#{key}=", _deserialize(type, value))
224
+ end
225
+ # or else data not found in attributes(hash), not an issue as the data can be optional
226
+ end
227
+
228
+ self
229
+ end
230
+
231
+ # Deserializes the data based on type
232
+ # @param string type Data type
233
+ # @param string value Value to be deserialized
234
+ # @return [Object] Deserialized data
235
+ def _deserialize(type, value)
236
+ case type.to_sym
237
+ when :DateTime
238
+ Date.parse value
239
+ when :Date
240
+ Date.parse value
241
+ when :String
242
+ value.to_s
243
+ when :Integer
244
+ value.to_i
245
+ when :Float
246
+ value.to_f
247
+ when :BOOLEAN
248
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
249
+ true
250
+ else
251
+ false
252
+ end
253
+ when :Object
254
+ # generic object (usually a Hash), return directly
255
+ value
256
+ when /\AArray<(?<inner_type>.+)>\z/
257
+ inner_type = Regexp.last_match[:inner_type]
258
+ value.map { |v| _deserialize(inner_type, v) }
259
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
260
+ k_type = Regexp.last_match[:k_type]
261
+ v_type = Regexp.last_match[:v_type]
262
+ {}.tap do |hash|
263
+ value.each do |k, v|
264
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
265
+ end
266
+ end
267
+ else
268
+ # model
269
+ temp_model = GroupDocsMergerCloud.const_get(type).new
270
+ temp_model.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ next if value.nil?
293
+ hash[param] = _to_hash(value)
294
+ end
295
+ hash
296
+ end
297
+
298
+ # Outputs non-array value in the form of hash
299
+ # For object, use to_hash. Otherwise, just return the value
300
+ # @param [Object] value Any valid value
301
+ # @return [Hash] Returns the value in the form of hash
302
+ def _to_hash(value)
303
+ if value.is_a?(Array)
304
+ value.compact.map { |v| _to_hash(v) }
305
+ elsif value.is_a?(Hash)
306
+ {}.tap do |hash|
307
+ value.each { |k, v| hash[k] = _to_hash(v) }
308
+ end
309
+ elsif value.respond_to? :to_hash
310
+ value.to_hash
311
+ else
312
+ value
313
+ end
314
+ end
315
+
316
+ end
317
+
318
+ end