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