groupdocs_annotation_cloud 20.10 → 21.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/groupdocs_annotation_cloud.rb +5 -1
  3. data/lib/groupdocs_annotation_cloud/api/annotate_api.rb +109 -166
  4. data/lib/groupdocs_annotation_cloud/api/file_api.rb +6 -6
  5. data/lib/groupdocs_annotation_cloud/api/folder_api.rb +6 -6
  6. data/lib/groupdocs_annotation_cloud/api/info_api.rb +11 -22
  7. data/lib/groupdocs_annotation_cloud/api/preview_api.rb +23 -90
  8. data/lib/groupdocs_annotation_cloud/api/storage_api.rb +5 -5
  9. data/lib/groupdocs_annotation_cloud/api_client.rb +1 -1
  10. data/lib/groupdocs_annotation_cloud/api_error.rb +1 -1
  11. data/lib/groupdocs_annotation_cloud/configuration.rb +1 -1
  12. data/lib/groupdocs_annotation_cloud/models/annotate_options.rb +281 -0
  13. data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +1 -1
  14. data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +1 -1
  15. data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +1 -1
  16. data/lib/groupdocs_annotation_cloud/models/disc_usage.rb +1 -1
  17. data/lib/groupdocs_annotation_cloud/models/document_info.rb +1 -1
  18. data/lib/groupdocs_annotation_cloud/models/error.rb +1 -1
  19. data/lib/groupdocs_annotation_cloud/models/error_details.rb +1 -1
  20. data/lib/groupdocs_annotation_cloud/models/file_info.rb +244 -0
  21. data/lib/groupdocs_annotation_cloud/models/file_version.rb +1 -1
  22. data/lib/groupdocs_annotation_cloud/models/file_versions.rb +1 -1
  23. data/lib/groupdocs_annotation_cloud/models/files_list.rb +1 -1
  24. data/lib/groupdocs_annotation_cloud/models/files_upload_result.rb +1 -1
  25. data/lib/groupdocs_annotation_cloud/models/format.rb +1 -1
  26. data/lib/groupdocs_annotation_cloud/models/formats_result.rb +1 -1
  27. data/lib/groupdocs_annotation_cloud/models/link.rb +1 -1
  28. data/lib/groupdocs_annotation_cloud/models/link_element.rb +1 -1
  29. data/lib/groupdocs_annotation_cloud/models/object_exist.rb +1 -1
  30. data/lib/groupdocs_annotation_cloud/models/page_image.rb +1 -1
  31. data/lib/groupdocs_annotation_cloud/models/page_images.rb +1 -1
  32. data/lib/groupdocs_annotation_cloud/models/page_info.rb +1 -1
  33. data/lib/groupdocs_annotation_cloud/models/point.rb +1 -1
  34. data/lib/groupdocs_annotation_cloud/models/preview_options.rb +324 -0
  35. data/lib/groupdocs_annotation_cloud/models/rectangle.rb +1 -1
  36. data/lib/groupdocs_annotation_cloud/models/remove_options.rb +236 -0
  37. data/lib/groupdocs_annotation_cloud/models/storage_exist.rb +1 -1
  38. data/lib/groupdocs_annotation_cloud/models/storage_file.rb +1 -1
  39. data/lib/groupdocs_annotation_cloud/version.rb +2 -2
  40. metadata +6 -2
@@ -0,0 +1,324 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="preview_options.rb">
4
+ # Copyright (c) 2003-2021 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 GroupDocsAnnotationCloud
31
+ # Represents options for GetPages API method
32
+ class PreviewOptions
33
+
34
+ # Input document description
35
+ attr_accessor :file_info
36
+
37
+ # Preview format. Supported values are: PNG, JPEG or BMP. Default value is PNG.
38
+ attr_accessor :format
39
+
40
+ # Page numbers to preview. All pages proceeded if not specified.
41
+ attr_accessor :page_numbers
42
+
43
+ # Preview image width. Not required. Default width used if not specified or 0.
44
+ attr_accessor :width
45
+
46
+ # Preview image height. Not required. Default width used if not specified or 0.
47
+ attr_accessor :height
48
+
49
+ # Render document comments. Default value is 'false'.
50
+ attr_accessor :render_comments
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
+ :'format' => :'Format',
78
+ :'page_numbers' => :'PageNumbers',
79
+ :'width' => :'Width',
80
+ :'height' => :'Height',
81
+ :'render_comments' => :'RenderComments'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'file_info' => :'FileInfo',
89
+ :'format' => :'String',
90
+ :'page_numbers' => :'Array<Integer>',
91
+ :'width' => :'Integer',
92
+ :'height' => :'Integer',
93
+ :'render_comments' => :'BOOLEAN'
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?(:'Format')
110
+ self.format = attributes[:'Format']
111
+ end
112
+
113
+ if attributes.key?(:'PageNumbers')
114
+ if (value = attributes[:'PageNumbers']).is_a?(Array)
115
+ self.page_numbers = value
116
+ end
117
+ end
118
+
119
+ if attributes.key?(:'Width')
120
+ self.width = attributes[:'Width']
121
+ end
122
+
123
+ if attributes.key?(:'Height')
124
+ self.height = attributes[:'Height']
125
+ end
126
+
127
+ if attributes.key?(:'RenderComments')
128
+ self.render_comments = attributes[:'RenderComments']
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 @format.nil?
138
+ invalid_properties.push("invalid value for 'format', format cannot be nil.")
139
+ end
140
+
141
+ if @width.nil?
142
+ invalid_properties.push("invalid value for 'width', width cannot be nil.")
143
+ end
144
+
145
+ if @height.nil?
146
+ invalid_properties.push("invalid value for 'height', height cannot be nil.")
147
+ end
148
+
149
+ if @render_comments.nil?
150
+ invalid_properties.push("invalid value for 'render_comments', render_comments cannot be nil.")
151
+ end
152
+
153
+ return invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ return false if @format.nil?
160
+ format_validator = EnumAttributeValidator.new('String', ["PNG", "JPEG", "BMP"])
161
+ return false unless format_validator.valid?(@format)
162
+ return false if @width.nil?
163
+ return false if @height.nil?
164
+ return false if @render_comments.nil?
165
+ return true
166
+ end
167
+
168
+ # Custom attribute writer method checking allowed values (enum).
169
+ # @param [Object] format Object to be assigned
170
+ def format=(format)
171
+ validator = EnumAttributeValidator.new('String', ["PNG", "JPEG", "BMP"])
172
+ if format.to_i == 0
173
+ unless validator.valid?(format)
174
+ # raise ArgumentError, "invalid value for 'format', must be one of #{validator.allowable_values}."
175
+ @format = validator.allowable_values[format.to_i]
176
+ end
177
+ @format = format
178
+ else
179
+ @format = validator.allowable_values[format.to_i]
180
+ end
181
+ end
182
+
183
+ # Checks equality by comparing each attribute.
184
+ # @param [Object] Object to be compared
185
+ def ==(other)
186
+ return true if self.equal?(other)
187
+ self.class == other.class &&
188
+ file_info == other.file_info &&
189
+ format == other.format &&
190
+ page_numbers == other.page_numbers &&
191
+ width == other.width &&
192
+ height == other.height &&
193
+ render_comments == other.render_comments
194
+ end
195
+
196
+ # @see the `==` method
197
+ # @param [Object] Object to be compared
198
+ def eql?(other)
199
+ self == other
200
+ end
201
+
202
+ # Calculates hash code according to all attributes.
203
+ # @return [Fixnum] Hash code
204
+ def hash
205
+ [file_info, format, page_numbers, width, height, render_comments].hash
206
+ end
207
+
208
+ # Downcases first letter.
209
+ # @return downcased string
210
+ def uncap(str)
211
+ str[0, 1].downcase + str[1..-1]
212
+ end
213
+
214
+ # Builds the object from hash
215
+ # @param [Hash] attributes Model attributes in the form of hash
216
+ # @return [Object] Returns the model itself
217
+ def build_from_hash(attributes)
218
+ return nil unless attributes.is_a?(Hash)
219
+ self.class.swagger_types.each_pair do |key, type|
220
+ pname = uncap(self.class.attribute_map[key]).intern
221
+ value = attributes[pname]
222
+ if type =~ /\AArray<(.*)>/i
223
+ # check to ensure the input is an array given that the the attribute
224
+ # is documented as an array but the input is not
225
+ if value.is_a?(Array)
226
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
227
+ end
228
+ elsif !value.nil?
229
+ self.send("#{key}=", _deserialize(type, value))
230
+ end
231
+ # or else data not found in attributes(hash), not an issue as the data can be optional
232
+ end
233
+
234
+ self
235
+ end
236
+
237
+ # Deserializes the data based on type
238
+ # @param string type Data type
239
+ # @param string value Value to be deserialized
240
+ # @return [Object] Deserialized data
241
+ def _deserialize(type, value)
242
+ case type.to_sym
243
+ when :DateTime
244
+ Date.parse value
245
+ when :Date
246
+ Date.parse value
247
+ when :String
248
+ value.to_s
249
+ when :Integer
250
+ value.to_i
251
+ when :Float
252
+ value.to_f
253
+ when :BOOLEAN
254
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
255
+ true
256
+ else
257
+ false
258
+ end
259
+ when :Object
260
+ # generic object (usually a Hash), return directly
261
+ value
262
+ when /\AArray<(?<inner_type>.+)>\z/
263
+ inner_type = Regexp.last_match[:inner_type]
264
+ value.map { |v| _deserialize(inner_type, v) }
265
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
266
+ k_type = Regexp.last_match[:k_type]
267
+ v_type = Regexp.last_match[:v_type]
268
+ {}.tap do |hash|
269
+ value.each do |k, v|
270
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
271
+ end
272
+ end
273
+ else
274
+ # model
275
+ temp_model = GroupDocsAnnotationCloud.const_get(type).new
276
+ temp_model.build_from_hash(value)
277
+ end
278
+ end
279
+
280
+ # Returns the string representation of the object
281
+ # @return [String] String presentation of the object
282
+ def to_s
283
+ to_hash.to_s
284
+ end
285
+
286
+ # to_body is an alias to to_hash (backward compatibility)
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_body
289
+ to_hash
290
+ end
291
+
292
+ # Returns the object in the form of hash
293
+ # @return [Hash] Returns the object in the form of hash
294
+ def to_hash
295
+ hash = {}
296
+ self.class.attribute_map.each_pair do |attr, param|
297
+ value = self.send(attr)
298
+ next if value.nil?
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+
304
+ # Outputs non-array value in the form of hash
305
+ # For object, use to_hash. Otherwise, just return the value
306
+ # @param [Object] value Any valid value
307
+ # @return [Hash] Returns the value in the form of hash
308
+ def _to_hash(value)
309
+ if value.is_a?(Array)
310
+ value.compact.map { |v| _to_hash(v) }
311
+ elsif value.is_a?(Hash)
312
+ {}.tap do |hash|
313
+ value.each { |k, v| hash[k] = _to_hash(v) }
314
+ end
315
+ elsif value.respond_to? :to_hash
316
+ value.to_hash
317
+ else
318
+ value
319
+ end
320
+ end
321
+
322
+ end
323
+
324
+ end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # --------------------------------------------------------------------------------------------------------------------
3
3
  # <copyright company="Aspose Pty Ltd" file="rectangle.rb">
4
- # Copyright (c) 2003-2020 Aspose Pty Ltd
4
+ # Copyright (c) 2003-2021 Aspose Pty Ltd
5
5
  # </copyright>
6
6
  # <summary>
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -0,0 +1,236 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="remove_options.rb">
4
+ # Copyright (c) 2003-2021 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 GroupDocsAnnotationCloud
31
+ # Options for removing annotations
32
+ class RemoveOptions
33
+
34
+ # Input document description
35
+ attr_accessor :file_info
36
+
37
+ # List of annotation IDs to remove from the document
38
+ attr_accessor :annotation_ids
39
+
40
+ # Path to output document in the cloud storage.
41
+ attr_accessor :output_path
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'file_info' => :'FileInfo',
47
+ :'annotation_ids' => :'AnnotationIds',
48
+ :'output_path' => :'OutputPath'
49
+ }
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.swagger_types
54
+ {
55
+ :'file_info' => :'FileInfo',
56
+ :'annotation_ids' => :'Array<Integer>',
57
+ :'output_path' => :'String'
58
+ }
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ return unless attributes.is_a?(Hash)
65
+
66
+ # convert string to symbol for hash key
67
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+
69
+ if attributes.key?(:'FileInfo')
70
+ self.file_info = attributes[:'FileInfo']
71
+ end
72
+
73
+ if attributes.key?(:'AnnotationIds')
74
+ if (value = attributes[:'AnnotationIds']).is_a?(Array)
75
+ self.annotation_ids = value
76
+ end
77
+ end
78
+
79
+ if attributes.key?(:'OutputPath')
80
+ self.output_path = attributes[:'OutputPath']
81
+ end
82
+
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properies with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = []
89
+ return invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ return true
96
+ end
97
+
98
+ # Checks equality by comparing each attribute.
99
+ # @param [Object] Object to be compared
100
+ def ==(other)
101
+ return true if self.equal?(other)
102
+ self.class == other.class &&
103
+ file_info == other.file_info &&
104
+ annotation_ids == other.annotation_ids &&
105
+ output_path == other.output_path
106
+ end
107
+
108
+ # @see the `==` method
109
+ # @param [Object] Object to be compared
110
+ def eql?(other)
111
+ self == other
112
+ end
113
+
114
+ # Calculates hash code according to all attributes.
115
+ # @return [Fixnum] Hash code
116
+ def hash
117
+ [file_info, annotation_ids, output_path].hash
118
+ end
119
+
120
+ # Downcases first letter.
121
+ # @return downcased string
122
+ def uncap(str)
123
+ str[0, 1].downcase + str[1..-1]
124
+ end
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.swagger_types.each_pair do |key, type|
132
+ pname = uncap(self.class.attribute_map[key]).intern
133
+ value = attributes[pname]
134
+ if type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the the attribute
136
+ # is documented as an array but the input is not
137
+ if value.is_a?(Array)
138
+ self.send("#{key}=", value.map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !value.nil?
141
+ self.send("#{key}=", _deserialize(type, value))
142
+ end
143
+ # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ Date.parse value
157
+ when :Date
158
+ Date.parse value
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else
186
+ # model
187
+ temp_model = GroupDocsAnnotationCloud.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end