groupdocs_annotation_cloud 18.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +344 -0
  3. data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +218 -0
  4. data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +395 -0
  5. data/lib/groupdocs_annotation_cloud/api/pdf_file_api.rb +281 -0
  6. data/lib/groupdocs_annotation_cloud/api_client.rb +390 -0
  7. data/lib/groupdocs_annotation_cloud/api_error.rb +56 -0
  8. data/lib/groupdocs_annotation_cloud/configuration.rb +95 -0
  9. data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +236 -0
  10. data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +504 -0
  11. data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +271 -0
  12. data/lib/groupdocs_annotation_cloud/models/document_info.rb +264 -0
  13. data/lib/groupdocs_annotation_cloud/models/image_page.rb +214 -0
  14. data/lib/groupdocs_annotation_cloud/models/image_pages.rb +219 -0
  15. data/lib/groupdocs_annotation_cloud/models/link.rb +236 -0
  16. data/lib/groupdocs_annotation_cloud/models/link_element.rb +206 -0
  17. data/lib/groupdocs_annotation_cloud/models/page_info.rb +258 -0
  18. data/lib/groupdocs_annotation_cloud/models/point.rb +216 -0
  19. data/lib/groupdocs_annotation_cloud/models/rectangle.rb +236 -0
  20. data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +53 -0
  21. data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +49 -0
  22. data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +53 -0
  23. data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +53 -0
  24. data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +53 -0
  25. data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +49 -0
  26. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +53 -0
  27. data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +53 -0
  28. data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +53 -0
  29. data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +57 -0
  30. data/lib/groupdocs_annotation_cloud/models/row_info.rb +276 -0
  31. data/lib/groupdocs_annotation_cloud/models/value_type.rb +196 -0
  32. data/lib/groupdocs_annotation_cloud/version.rb +29 -0
  33. data/lib/groupdocs_annotation_cloud.rb +80 -0
  34. metadata +164 -0
@@ -0,0 +1,504 @@
1
+ #
2
+ # --------------------------------------------------------------------------------------------------------------------
3
+ # <copyright company="Aspose Pty Ltd" file="annotation_info.rb">
4
+ # Copyright (c) 2003-2018 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
+
32
+ class AnnotationInfo
33
+
34
+ # Gets or sets the unique identifier.
35
+ attr_accessor :guid
36
+
37
+ # Gets or sets the document unique identifier.
38
+ attr_accessor :document_guid
39
+
40
+ # Gets or sets the text.
41
+ attr_accessor :text
42
+
43
+ # Gets or sets the creator unique identifier.
44
+ attr_accessor :creator_guid
45
+
46
+ # Gets or sets the name of the creator.
47
+ attr_accessor :creator_name
48
+
49
+ # Gets or sets the creator email.
50
+ attr_accessor :creator_email
51
+
52
+ # Gets or sets the box.
53
+ attr_accessor :box
54
+
55
+ # Gets or sets the page number.
56
+ attr_accessor :page_number
57
+
58
+ # Gets or sets the annotation position.
59
+ attr_accessor :annotation_position
60
+
61
+ # Gets or sets the SVG path.
62
+ attr_accessor :svg_path
63
+
64
+ # Gets or sets the type.
65
+ attr_accessor :type
66
+
67
+ # Gets or sets the access.
68
+ attr_accessor :access
69
+
70
+ # Gets or sets the replies.
71
+ attr_accessor :replies
72
+
73
+ # Gets or sets the created on.
74
+ attr_accessor :created_on
75
+
76
+ # Gets or sets the color of the font.
77
+ attr_accessor :font_color
78
+
79
+ # Gets or sets the color of the pen.
80
+ attr_accessor :pen_color
81
+
82
+ # Gets or sets the width of the pen.
83
+ attr_accessor :pen_width
84
+
85
+ # Gets or sets the pen style.
86
+ attr_accessor :pen_style
87
+
88
+ # Gets or sets the color of the background.
89
+ attr_accessor :background_color
90
+
91
+ # Gets or sets the field text.
92
+ attr_accessor :field_text
93
+
94
+ # Gets or sets the font family.
95
+ attr_accessor :font_family
96
+
97
+ # Gets or sets the size of the font.
98
+ attr_accessor :font_size
99
+ class EnumAttributeValidator
100
+ attr_reader :datatype
101
+ attr_reader :allowable_values
102
+
103
+ def initialize(datatype, allowable_values)
104
+ @allowable_values = allowable_values.map do |value|
105
+ case datatype.to_s
106
+ when /Integer/i
107
+ value.to_i
108
+ when /Float/i
109
+ value.to_f
110
+ else
111
+ value
112
+ end
113
+ end
114
+ end
115
+
116
+ def valid?(value)
117
+ !value || allowable_values.include?(value)
118
+ end
119
+ end
120
+
121
+ # Attribute mapping from ruby-style variable name to JSON key.
122
+ def self.attribute_map
123
+ {
124
+ :'guid' => :'guid',
125
+ :'document_guid' => :'documentGuid',
126
+ :'text' => :'text',
127
+ :'creator_guid' => :'creatorGuid',
128
+ :'creator_name' => :'creatorName',
129
+ :'creator_email' => :'creatorEmail',
130
+ :'box' => :'box',
131
+ :'page_number' => :'pageNumber',
132
+ :'annotation_position' => :'annotationPosition',
133
+ :'svg_path' => :'svgPath',
134
+ :'type' => :'type',
135
+ :'access' => :'access',
136
+ :'replies' => :'replies',
137
+ :'created_on' => :'createdOn',
138
+ :'font_color' => :'fontColor',
139
+ :'pen_color' => :'penColor',
140
+ :'pen_width' => :'penWidth',
141
+ :'pen_style' => :'penStyle',
142
+ :'background_color' => :'backgroundColor',
143
+ :'field_text' => :'fieldText',
144
+ :'font_family' => :'fontFamily',
145
+ :'font_size' => :'fontSize'
146
+ }
147
+ end
148
+
149
+ # Attribute type mapping.
150
+ def self.swagger_types
151
+ {
152
+ :'guid' => :'String',
153
+ :'document_guid' => :'Integer',
154
+ :'text' => :'String',
155
+ :'creator_guid' => :'String',
156
+ :'creator_name' => :'String',
157
+ :'creator_email' => :'String',
158
+ :'box' => :'Rectangle',
159
+ :'page_number' => :'Integer',
160
+ :'annotation_position' => :'Point',
161
+ :'svg_path' => :'String',
162
+ :'type' => :'String',
163
+ :'access' => :'String',
164
+ :'replies' => :'Array<AnnotationReplyInfo>',
165
+ :'created_on' => :'DateTime',
166
+ :'font_color' => :'Integer',
167
+ :'pen_color' => :'Integer',
168
+ :'pen_width' => :'Integer',
169
+ :'pen_style' => :'Integer',
170
+ :'background_color' => :'Integer',
171
+ :'field_text' => :'String',
172
+ :'font_family' => :'String',
173
+ :'font_size' => :'Float'
174
+ }
175
+ end
176
+
177
+ # Initializes the object
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ def initialize(attributes = {})
180
+ return unless attributes.is_a?(Hash)
181
+
182
+ # convert string to symbol for hash key
183
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
184
+
185
+ if attributes.key?(:'Guid')
186
+ self.guid = attributes[:'Guid']
187
+ end
188
+
189
+ if attributes.key?(:'DocumentGuid')
190
+ self.document_guid = attributes[:'DocumentGuid']
191
+ end
192
+
193
+ if attributes.key?(:'Text')
194
+ self.text = attributes[:'Text']
195
+ end
196
+
197
+ if attributes.key?(:'CreatorGuid')
198
+ self.creator_guid = attributes[:'CreatorGuid']
199
+ end
200
+
201
+ if attributes.key?(:'CreatorName')
202
+ self.creator_name = attributes[:'CreatorName']
203
+ end
204
+
205
+ if attributes.key?(:'CreatorEmail')
206
+ self.creator_email = attributes[:'CreatorEmail']
207
+ end
208
+
209
+ if attributes.key?(:'Box')
210
+ self.box = attributes[:'Box']
211
+ end
212
+
213
+ if attributes.key?(:'PageNumber')
214
+ self.page_number = attributes[:'PageNumber']
215
+ end
216
+
217
+ if attributes.key?(:'AnnotationPosition')
218
+ self.annotation_position = attributes[:'AnnotationPosition']
219
+ end
220
+
221
+ if attributes.key?(:'SvgPath')
222
+ self.svg_path = attributes[:'SvgPath']
223
+ end
224
+
225
+ if attributes.key?(:'Type')
226
+ self.type = attributes[:'Type']
227
+ end
228
+
229
+ if attributes.key?(:'Access')
230
+ self.access = attributes[:'Access']
231
+ end
232
+
233
+ if attributes.key?(:'Replies')
234
+ if (value = attributes[:'Replies']).is_a?(Array)
235
+ self.replies = value
236
+ end
237
+ end
238
+
239
+ if attributes.key?(:'CreatedOn')
240
+ self.created_on = attributes[:'CreatedOn']
241
+ end
242
+
243
+ if attributes.key?(:'FontColor')
244
+ self.font_color = attributes[:'FontColor']
245
+ end
246
+
247
+ if attributes.key?(:'PenColor')
248
+ self.pen_color = attributes[:'PenColor']
249
+ end
250
+
251
+ if attributes.key?(:'PenWidth')
252
+ self.pen_width = attributes[:'PenWidth']
253
+ end
254
+
255
+ if attributes.key?(:'PenStyle')
256
+ self.pen_style = attributes[:'PenStyle']
257
+ end
258
+
259
+ if attributes.key?(:'BackgroundColor')
260
+ self.background_color = attributes[:'BackgroundColor']
261
+ end
262
+
263
+ if attributes.key?(:'FieldText')
264
+ self.field_text = attributes[:'FieldText']
265
+ end
266
+
267
+ if attributes.key?(:'FontFamily')
268
+ self.font_family = attributes[:'FontFamily']
269
+ end
270
+
271
+ if attributes.key?(:'FontSize')
272
+ self.font_size = attributes[:'FontSize']
273
+ end
274
+
275
+ end
276
+
277
+ # Show invalid properties with the reasons. Usually used together with valid?
278
+ # @return Array for valid properies with the reasons
279
+ def list_invalid_properties
280
+ invalid_properties = []
281
+ if @document_guid.nil?
282
+ invalid_properties.push("invalid value for 'document_guid', document_guid cannot be nil.")
283
+ end
284
+
285
+ if @box.nil?
286
+ invalid_properties.push("invalid value for 'box', box cannot be nil.")
287
+ end
288
+
289
+ if @type.nil?
290
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
291
+ end
292
+
293
+ if @created_on.nil?
294
+ invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
295
+ end
296
+
297
+ if @font_color.nil?
298
+ invalid_properties.push("invalid value for 'font_color', font_color cannot be nil.")
299
+ end
300
+
301
+ return invalid_properties
302
+ end
303
+
304
+ # Check to see if the all the properties in the model are valid
305
+ # @return true if the model is valid
306
+ def valid?
307
+ return false if @document_guid.nil?
308
+ return false if @box.nil?
309
+ return false if @type.nil?
310
+ type_validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
311
+ return false unless type_validator.valid?(@type)
312
+ access_validator = EnumAttributeValidator.new('String', ["Public", "Private"])
313
+ return false unless access_validator.valid?(@access)
314
+ return false if @created_on.nil?
315
+ return false if @font_color.nil?
316
+ return true
317
+ end
318
+
319
+ # Custom attribute writer method checking allowed values (enum).
320
+ # @param [Object] type Object to be assigned
321
+ def type=(type)
322
+ validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
323
+ if validator.valid?(type)
324
+ @type = type
325
+ elsif type.to_i >= 0 && type.to_i < validator.allowable_values.count
326
+ @type = validator.allowable_values[type.to_i]
327
+ else
328
+ raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
329
+ end
330
+ end
331
+
332
+ # Custom attribute writer method checking allowed values (enum).
333
+ # @param [Object] access Object to be assigned
334
+ def access=(access)
335
+ validator = EnumAttributeValidator.new('String', ["Public", "Private"])
336
+ if validator.valid?(access)
337
+ @access = access
338
+ elsif access.to_i >= 0 && access.to_i < validator.allowable_values.count
339
+ @access = validator.allowable_values[access.to_i]
340
+ else
341
+ raise ArgumentError, "invalid value for 'access', must be one of #{validator.allowable_values}."
342
+ end
343
+ end
344
+
345
+ # Checks equality by comparing each attribute.
346
+ # @param [Object] Object to be compared
347
+ def ==(other)
348
+ return true if self.equal?(other)
349
+ self.class == other.class &&
350
+ guid == other.guid &&
351
+ document_guid == other.document_guid &&
352
+ text == other.text &&
353
+ creator_guid == other.creator_guid &&
354
+ creator_name == other.creator_name &&
355
+ creator_email == other.creator_email &&
356
+ box == other.box &&
357
+ page_number == other.page_number &&
358
+ annotation_position == other.annotation_position &&
359
+ svg_path == other.svg_path &&
360
+ type == other.type &&
361
+ access == other.access &&
362
+ replies == other.replies &&
363
+ created_on == other.created_on &&
364
+ font_color == other.font_color &&
365
+ pen_color == other.pen_color &&
366
+ pen_width == other.pen_width &&
367
+ pen_style == other.pen_style &&
368
+ background_color == other.background_color &&
369
+ field_text == other.field_text &&
370
+ font_family == other.font_family &&
371
+ font_size == other.font_size
372
+ end
373
+
374
+ # @see the `==` method
375
+ # @param [Object] Object to be compared
376
+ def eql?(other)
377
+ self == other
378
+ end
379
+
380
+ # Calculates hash code according to all attributes.
381
+ # @return [Fixnum] Hash code
382
+ def hash
383
+ [guid, document_guid, text, creator_guid, creator_name, creator_email, box, page_number, annotation_position, svg_path, type, access, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, field_text, font_family, font_size].hash
384
+ end
385
+
386
+ # Builds the object from hash
387
+ # @param [Hash] attributes Model attributes in the form of hash
388
+ # @return [Object] Returns the model itself
389
+ def build_from_hash(attributes)
390
+ return nil unless attributes.is_a?(Hash)
391
+ self.class.swagger_types.each_pair do |key, type|
392
+ if type =~ /\AArray<(.*)>/i
393
+ # check to ensure the input is an array given that the the attribute
394
+ # is documented as an array but the input is not
395
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
396
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
397
+ end
398
+ elsif !attributes[self.class.attribute_map[key]].nil?
399
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
400
+ end
401
+ # or else data not found in attributes(hash), not an issue as the data can be optional
402
+ end
403
+
404
+ self
405
+ end
406
+
407
+ # Deserializes the data based on type
408
+ # @param string type Data type
409
+ # @param string value Value to be deserialized
410
+ # @return [Object] Deserialized data
411
+ def _deserialize(type, value)
412
+ case type.to_sym
413
+ when :DateTime
414
+ Time.at(/\d/.match(value)[0].to_f).to_datetime
415
+ when :Date
416
+ Time.at(/\d/.match(value)[0].to_f).to_date
417
+ when :String
418
+ value.to_s
419
+ when :Integer
420
+ value.to_i
421
+ when :Float
422
+ value.to_f
423
+ when :BOOLEAN
424
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
425
+ true
426
+ else
427
+ false
428
+ end
429
+ when :Object
430
+ # generic object (usually a Hash), return directly
431
+ value
432
+ when /\AArray<(?<inner_type>.+)>\z/
433
+ inner_type = Regexp.last_match[:inner_type]
434
+ value.map { |v| _deserialize(inner_type, v) }
435
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
436
+ k_type = Regexp.last_match[:k_type]
437
+ v_type = Regexp.last_match[:v_type]
438
+ {}.tap do |hash|
439
+ value.each do |k, v|
440
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
441
+ end
442
+ end
443
+ else
444
+ # model
445
+ temp_model = GroupDocsAnnotationCloud.const_get(type).new
446
+ temp_model.build_from_hash(value)
447
+ end
448
+ end
449
+
450
+ # Returns the string representation of the object
451
+ # @return [String] String presentation of the object
452
+ def to_s
453
+ to_hash.to_s
454
+ end
455
+
456
+ # to_body is an alias to to_hash (backward compatibility)
457
+ # @return [Hash] Returns the object in the form of hash
458
+ def to_body
459
+ to_hash
460
+ end
461
+
462
+ # Returns the object in the form of hash
463
+ # @return [Hash] Returns the object in the form of hash
464
+ def to_hash
465
+ hash = {}
466
+ self.class.attribute_map.each_pair do |attr, param|
467
+ value = self.send(attr)
468
+ next if value.nil?
469
+ if attr == :type
470
+ validator = EnumAttributeValidator.new('String', ["Text", "Area", "Point", "TextStrikeout", "Polyline", "TextField", "Watermark", "TextReplacement", "Arrow", "TextRedaction", "ResourcesRedaction", "TextUnderline", "Distance"])
471
+ value = validator.allowable_values.index(value)
472
+ hash[param] = _to_hash(value)
473
+ elsif attr == :access
474
+ validator = EnumAttributeValidator.new('String', ["Public", "Private"])
475
+ value = validator.allowable_values.index(value)
476
+ hash[param] = _to_hash(value)
477
+ else
478
+ hash[param] = _to_hash(value)
479
+ end
480
+ end
481
+ hash
482
+ end
483
+
484
+ # Outputs non-array value in the form of hash
485
+ # For object, use to_hash. Otherwise, just return the value
486
+ # @param [Object] value Any valid value
487
+ # @return [Hash] Returns the value in the form of hash
488
+ def _to_hash(value)
489
+ if value.is_a?(Array)
490
+ value.compact.map { |v| _to_hash(v) }
491
+ elsif value.is_a?(Hash)
492
+ {}.tap do |hash|
493
+ value.each { |k, v| hash[k] = _to_hash(v) }
494
+ end
495
+ elsif value.respond_to? :to_hash
496
+ value.to_hash
497
+ else
498
+ value
499
+ end
500
+ end
501
+
502
+ end
503
+
504
+ end