Class: GroupDocsAnnotationCloud::AnnotationInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_annotation_cloud/models/annotation_info.rb

Overview

Describes annotation properties

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AnnotationInfo

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 219

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.key?(:'Id')
    self.id = attributes[:'Id']
  end

  if attributes.key?(:'Text')
    self.text = attributes[:'Text']
  end

  if attributes.key?(:'TextToReplace')
    self.text_to_replace = attributes[:'TextToReplace']
  end

  if attributes.key?(:'HorizontalAlignment')
    self.horizontal_alignment = attributes[:'HorizontalAlignment']
  end

  if attributes.key?(:'VerticalAlignment')
    self.vertical_alignment = attributes[:'VerticalAlignment']
  end

  if attributes.key?(:'CreatorId')
    self.creator_id = attributes[:'CreatorId']
  end

  if attributes.key?(:'CreatorName')
    self.creator_name = attributes[:'CreatorName']
  end

  if attributes.key?(:'CreatorEmail')
    self.creator_email = attributes[:'CreatorEmail']
  end

  if attributes.key?(:'Box')
    self.box = attributes[:'Box']
  end

  if attributes.key?(:'Points')
    if (value = attributes[:'Points']).is_a?(Array)
      self.points = value
    end
  end

  if attributes.key?(:'PageNumber')
    self.page_number = attributes[:'PageNumber']
  end

  if attributes.key?(:'AnnotationPosition')
    self.annotation_position = attributes[:'AnnotationPosition']
  end

  if attributes.key?(:'SvgPath')
    self.svg_path = attributes[:'SvgPath']
  end

  if attributes.key?(:'Type')
    self.type = attributes[:'Type']
  end

  if attributes.key?(:'Replies')
    if (value = attributes[:'Replies']).is_a?(Array)
      self.replies = value
    end
  end

  if attributes.key?(:'CreatedOn')
    self.created_on = attributes[:'CreatedOn']
  end

  if attributes.key?(:'FontColor')
    self.font_color = attributes[:'FontColor']
  end

  if attributes.key?(:'PenColor')
    self.pen_color = attributes[:'PenColor']
  end

  if attributes.key?(:'PenWidth')
    self.pen_width = attributes[:'PenWidth']
  end

  if attributes.key?(:'PenStyle')
    self.pen_style = attributes[:'PenStyle']
  end

  if attributes.key?(:'BackgroundColor')
    self.background_color = attributes[:'BackgroundColor']
  end

  if attributes.key?(:'SquigglyColor')
    self.squiggly_color = attributes[:'SquigglyColor']
  end

  if attributes.key?(:'FontFamily')
    self.font_family = attributes[:'FontFamily']
  end

  if attributes.key?(:'FontSize')
    self.font_size = attributes[:'FontSize']
  end

  if attributes.key?(:'Opacity')
    self.opacity = attributes[:'Opacity']
  end

  if attributes.key?(:'Angle')
    self.angle = attributes[:'Angle']
  end

  if attributes.key?(:'ZIndex')
    self.z_index = attributes[:'ZIndex']
  end

  if attributes.key?(:'Url')
    self.url = attributes[:'Url']
  end

  if attributes.key?(:'ImagePath')
    self.image_path = attributes[:'ImagePath']
  end

  if attributes.key?(:'AutoScale')
    self.auto_scale = attributes[:'AutoScale']
  end

end

Instance Attribute Details

#angleObject

Gets or sets the watermark annotation’s rotation angle



110
111
112
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 110

def angle
  @angle
end

#annotation_positionObject

Gets or sets the annotation position



68
69
70
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 68

def annotation_position
  @annotation_position
end

#auto_scaleObject

Sets auto scale for watermark annotation



122
123
124
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 122

def auto_scale
  @auto_scale
end

#background_colorObject

Gets or sets the annotation’s background color



95
96
97
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 95

def background_color
  @background_color
end

#boxObject

Gets or sets the box where annotation will be placed



59
60
61
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 59

def box
  @box
end

#created_onObject

Gets or sets the annotation created on date



80
81
82
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 80

def created_on
  @created_on
end

#creator_emailObject

Gets or sets the creator’s email



56
57
58
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 56

def creator_email
  @creator_email
end

#creator_idObject

Gets or sets the creator unique identifier



50
51
52
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 50

def creator_id
  @creator_id
end

#creator_nameObject

Gets or sets the name of the creator



53
54
55
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 53

def creator_name
  @creator_name
end

#font_colorObject

Gets or sets the annotation’s font color



83
84
85
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 83

def font_color
  @font_color
end

#font_familyObject

Gets or sets the annotation’s font family



101
102
103
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 101

def font_family
  @font_family
end

#font_sizeObject

Gets or sets the annotation’s font size



104
105
106
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 104

def font_size
  @font_size
end

#horizontal_alignmentObject

Gets or sets text horizontal alignment



44
45
46
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 44

def horizontal_alignment
  @horizontal_alignment
end

#idObject

Gets or sets the unique identifier



35
36
37
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 35

def id
  @id
end

#image_pathObject

Gets or sets image file path in cloud storage, for Image annotations



119
120
121
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 119

def image_path
  @image_path
end

#opacityObject

Gets or sets the annotation’s opacity



107
108
109
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 107

def opacity
  @opacity
end

#page_numberObject

Gets or sets the number of page where annotation will be placed



65
66
67
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 65

def page_number
  @page_number
end

#pen_colorObject

Gets or sets the annotation’s pen color



86
87
88
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 86

def pen_color
  @pen_color
end

#pen_styleObject

Gets or sets the annotation’s pen style



92
93
94
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 92

def pen_style
  @pen_style
end

#pen_widthObject

Gets or sets the annotation’s pen width



89
90
91
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 89

def pen_width
  @pen_width
end

#pointsObject

Gets or sets collection of points that describe rectangles with text



62
63
64
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 62

def points
  @points
end

#repliesObject

Gets or sets the array of annotation replies



77
78
79
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 77

def replies
  @replies
end

#squiggly_colorObject

Gets or sets annotation color



98
99
100
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 98

def squiggly_color
  @squiggly_color
end

#svg_pathObject

Gets or sets the annotation SVG path



71
72
73
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 71

def svg_path
  @svg_path
end

#textObject

Gets or sets the annotation text



38
39
40
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 38

def text
  @text
end

#text_to_replaceObject

GGets or sets text to be replaced



41
42
43
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 41

def text_to_replace
  @text_to_replace
end

#typeObject

Gets or sets the annotation type



74
75
76
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 74

def type
  @type
end

#urlObject

Gets or sets annotation link url



116
117
118
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 116

def url
  @url
end

#vertical_alignmentObject

Gets or sets text vertical alignment



47
48
49
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 47

def vertical_alignment
  @vertical_alignment
end

#z_indexObject

Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element.



113
114
115
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 113

def z_index
  @z_index
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 146

def self.attribute_map
  {
    :'id' => :'Id',
    :'text' => :'Text',
    :'text_to_replace' => :'TextToReplace',
    :'horizontal_alignment' => :'HorizontalAlignment',
    :'vertical_alignment' => :'VerticalAlignment',
    :'creator_id' => :'CreatorId',
    :'creator_name' => :'CreatorName',
    :'creator_email' => :'CreatorEmail',
    :'box' => :'Box',
    :'points' => :'Points',
    :'page_number' => :'PageNumber',
    :'annotation_position' => :'AnnotationPosition',
    :'svg_path' => :'SvgPath',
    :'type' => :'Type',
    :'replies' => :'Replies',
    :'created_on' => :'CreatedOn',
    :'font_color' => :'FontColor',
    :'pen_color' => :'PenColor',
    :'pen_width' => :'PenWidth',
    :'pen_style' => :'PenStyle',
    :'background_color' => :'BackgroundColor',
    :'squiggly_color' => :'SquigglyColor',
    :'font_family' => :'FontFamily',
    :'font_size' => :'FontSize',
    :'opacity' => :'Opacity',
    :'angle' => :'Angle',
    :'z_index' => :'ZIndex',
    :'url' => :'Url',
    :'image_path' => :'ImagePath',
    :'auto_scale' => :'AutoScale'
  }
end

.swagger_typesObject

Attribute type mapping.



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 182

def self.swagger_types
  {
    :'id' => :'Integer',
    :'text' => :'String',
    :'text_to_replace' => :'String',
    :'horizontal_alignment' => :'String',
    :'vertical_alignment' => :'String',
    :'creator_id' => :'Integer',
    :'creator_name' => :'String',
    :'creator_email' => :'String',
    :'box' => :'Rectangle',
    :'points' => :'Array<Point>',
    :'page_number' => :'Integer',
    :'annotation_position' => :'Point',
    :'svg_path' => :'String',
    :'type' => :'String',
    :'replies' => :'Array<AnnotationReplyInfo>',
    :'created_on' => :'DateTime',
    :'font_color' => :'Integer',
    :'pen_color' => :'Integer',
    :'pen_width' => :'Integer',
    :'pen_style' => :'String',
    :'background_color' => :'Integer',
    :'squiggly_color' => :'Integer',
    :'font_family' => :'String',
    :'font_size' => :'Float',
    :'opacity' => :'Float',
    :'angle' => :'Float',
    :'z_index' => :'Integer',
    :'url' => :'String',
    :'image_path' => :'String',
    :'auto_scale' => :'BOOLEAN'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 479

def ==(other)
  return true if self.equal?(other)
  self.class == other.class &&
      id == other.id &&
      text == other.text &&
      text_to_replace == other.text_to_replace &&
      horizontal_alignment == other.horizontal_alignment &&
      vertical_alignment == other.vertical_alignment &&
      creator_id == other.creator_id &&
      creator_name == other.creator_name &&
      creator_email == other.creator_email &&
      box == other.box &&
      points == other.points &&
      page_number == other.page_number &&
      annotation_position == other.annotation_position &&
      svg_path == other.svg_path &&
      type == other.type &&
      replies == other.replies &&
      created_on == other.created_on &&
      font_color == other.font_color &&
      pen_color == other.pen_color &&
      pen_width == other.pen_width &&
      pen_style == other.pen_style &&
      background_color == other.background_color &&
      squiggly_color == other.squiggly_color &&
      font_family == other.font_family &&
      font_size == other.font_size &&
      opacity == other.opacity &&
      angle == other.angle &&
      z_index == other.z_index &&
      url == other.url &&
      image_path == other.image_path &&
      auto_scale == other.auto_scale
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 559

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    Date.parse value
  when :Date
    Date.parse value
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else
  # model
    temp_model = GroupDocsAnnotationCloud.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



626
627
628
629
630
631
632
633
634
635
636
637
638
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 626

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 535

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    pname = uncap(self.class.attribute_map[key]).intern
    value = attributes[pname]
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not                    
      if value.is_a?(Array)
        self.send("#{key}=", value.map { |v| _deserialize($1, v) })
      end
    elsif !value.nil?
      self.send("#{key}=", _deserialize(type, value))
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


516
517
518
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 516

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



522
523
524
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 522

def hash
  [id, text, text_to_replace, horizontal_alignment, vertical_alignment, creator_id, creator_name, creator_email, box, points, page_number, annotation_position, svg_path, type, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, squiggly_color, font_family, font_size, opacity, angle, z_index, url, image_path, auto_scale].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properies with the reasons



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 353

def list_invalid_properties
  invalid_properties = []
  if @id.nil?
    invalid_properties.push("invalid value for 'id', id cannot be nil.")
  end

  if @horizontal_alignment.nil?
    invalid_properties.push("invalid value for 'horizontal_alignment', horizontal_alignment cannot be nil.")
  end

  if @vertical_alignment.nil?
    invalid_properties.push("invalid value for 'vertical_alignment', vertical_alignment cannot be nil.")
  end

  if @creator_id.nil?
    invalid_properties.push("invalid value for 'creator_id', creator_id cannot be nil.")
  end

  if @box.nil?
    invalid_properties.push("invalid value for 'box', box cannot be nil.")
  end

  if @type.nil?
    invalid_properties.push("invalid value for 'type', type cannot be nil.")
  end

  if @created_on.nil?
    invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
  end

  if @z_index.nil?
    invalid_properties.push("invalid value for 'z_index', z_index cannot be nil.")
  end

  if @auto_scale.nil?
    invalid_properties.push("invalid value for 'auto_scale', auto_scale cannot be nil.")
  end

  return invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



606
607
608
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 606

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



612
613
614
615
616
617
618
619
620
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 612

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



600
601
602
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 600

def to_s
  to_hash.to_s
end

#uncap(str) ⇒ Object

Downcases first letter.

Returns:

  • downcased string



528
529
530
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 528

def uncap(str)
  str[0, 1].downcase + str[1..-1]
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/groupdocs_annotation_cloud/models/annotation_info.rb', line 396

def valid?
  return false if @id.nil?
  return false if @horizontal_alignment.nil?
  horizontal_alignment_validator = EnumAttributeValidator.new('String', ["None", "Left", "Center", "Right"])
  return false unless horizontal_alignment_validator.valid?(@horizontal_alignment)
  return false if @vertical_alignment.nil?
  vertical_alignment_validator = EnumAttributeValidator.new('String', ["None", "Top", "Center", "Bottom"])
  return false unless vertical_alignment_validator.valid?(@vertical_alignment)
  return false if @creator_id.nil?
  return false if @box.nil?
  return false if @type.nil?
  type_validator = EnumAttributeValidator.new('String', ["None", "Area", "Arrow", "Distance", "Ellipse", "Link", "Point", "Polyline", "ResourcesRedaction", "TextField", "TextHighlight", "TextRedaction", "TextReplacement", "TextStrikeout", "TextUnderline", "Watermark", "Image", "TextSquiggly"])
  return false unless type_validator.valid?(@type)
  return false if @created_on.nil?
  pen_style_validator = EnumAttributeValidator.new('String', ["Solid", "Dash", "DashDot", "Dot", "LongDash", "DashDotDot"])
  return false unless pen_style_validator.valid?(@pen_style)
  return false if @z_index.nil?
  return false if @auto_scale.nil?
  return true
end