Class: GroupDocs::Document::Annotation
- Inherits:
-
Api::Entity
- Object
- Api::Entity
- GroupDocs::Document::Annotation
- Includes:
- Api::Helpers::AccessMode
- Defined in:
- lib/groupdocs/document/annotation.rb
Defined Under Namespace
Classes: MarkerPosition, Reply, Reviewer
Constant Summary collapse
- TYPES =
updated in release 1.7.0
%w(Text Area Point TextStrikeout Polyline TextField Watermark TextReplacement Arrow TextRedaction ResourceRedaction ResourceRedaction TextUnderline Distance All)
Instance Attribute Summary collapse
-
#access ⇒ Symbol
Converts access mode to human-readable format.
- #annotationPosition ⇒ Object
- #backgroundColor ⇒ Object
- #box ⇒ Object
- #createdOn ⇒ Object
- #creatorEmail ⇒ Object
- #creatorGuid ⇒ Object
- #creatorName ⇒ Object
- #document ⇒ Object
- #documentGuid ⇒ Object
- #fieldText ⇒ Object
- #fontColor ⇒ Object
-
#fontFamily ⇒ Object
Returns the value of attribute fontFamily.
-
#fontSize ⇒ Object
Returns the value of attribute fontSize.
- #guid ⇒ Object
-
#height ⇒ Object
Returns the value of attribute height.
- #id ⇒ Object
- #layerId ⇒ Object
-
#pageNumber ⇒ Object
added in release 1.5.8.
-
#penColor ⇒ Object
added in release 1.7.0.
- #penStyle ⇒ Object
- #penWidth ⇒ Object
- #replies ⇒ Object
- #replyGuid ⇒ Object
- #serverTime ⇒ Object
- #sessionGuid ⇒ Object
-
#type ⇒ Symbol
Returns type in human-readable format.
- #width ⇒ Object
Instance Method Summary collapse
-
#add_reply(reply) ⇒ Object
Adds reply to annotation.
-
#create!(info, access = {}) ⇒ Object
Creates new annotation.
-
#created_on ⇒ Time
Converts timestamp which is return by API server to Time object.
-
#initialize(options = {}, &blk) ⇒ Annotation
constructor
Creates new GroupDocs::Document::Annotation.
-
#move!(x, y, access = {}) ⇒ Object
Moves annotation to given coordinates.
-
#move_marker!(marker, access = {}) ⇒ Object
Changed in release 1.5.8.
-
#remove!(access = {}) ⇒ Object
Removes annotation.
-
#remove_annotations!(access = {}) ⇒ Object
added in release 1.6.0.
-
#replies!(options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies..
-
#resize!(x, y, access = {}) ⇒ Object
Resize annotation.
-
#set_access!(mode, access = {}) ⇒ Object
Sets access mode.
-
#text_color!(font_color, access = {}) ⇒ Object
Save Text Of Text Color.
-
#text_info!(fieldText, fontFamily, fontSize, access = {}) ⇒ Object
Save Text Of Text Field.
Methods inherited from Api::Entity
Methods included from Api::Helpers::Accessor
Constructor Details
#initialize(options = {}, &blk) ⇒ Annotation
Creates new GroupDocs::Document::Annotation.
102 103 104 105 106 |
# File 'lib/groupdocs/document/annotation.rb', line 102 def initialize( = {}, &blk) super(, &blk) document.is_a?(GroupDocs::Document) or raise ArgumentError, "You have to pass GroupDocs::Document object: #{document.inspect}." end |
Instance Attribute Details
#access ⇒ Symbol
Converts access mode to human-readable format.
33 34 35 |
# File 'lib/groupdocs/document/annotation.rb', line 33 def access @access end |
#annotationPosition ⇒ Object
39 40 41 |
# File 'lib/groupdocs/document/annotation.rb', line 39 def annotationPosition @annotationPosition end |
#backgroundColor ⇒ Object
71 72 73 |
# File 'lib/groupdocs/document/annotation.rb', line 71 def backgroundColor @backgroundColor end |
#box ⇒ Object
35 36 37 |
# File 'lib/groupdocs/document/annotation.rb', line 35 def box @box end |
#createdOn ⇒ Object
29 30 31 |
# File 'lib/groupdocs/document/annotation.rb', line 29 def createdOn @createdOn end |
#creatorEmail ⇒ Object
67 68 69 |
# File 'lib/groupdocs/document/annotation.rb', line 67 def creatorEmail @creatorEmail end |
#creatorGuid ⇒ Object
25 26 27 |
# File 'lib/groupdocs/document/annotation.rb', line 25 def creatorGuid @creatorGuid end |
#creatorName ⇒ Object
65 66 67 |
# File 'lib/groupdocs/document/annotation.rb', line 65 def creatorName @creatorName end |
#document ⇒ Object
15 16 17 |
# File 'lib/groupdocs/document/annotation.rb', line 15 def document @document end |
#documentGuid ⇒ Object
23 24 25 |
# File 'lib/groupdocs/document/annotation.rb', line 23 def documentGuid @documentGuid end |
#fieldText ⇒ Object
44 45 46 |
# File 'lib/groupdocs/document/annotation.rb', line 44 def fieldText @fieldText end |
#fontColor ⇒ Object
48 49 50 |
# File 'lib/groupdocs/document/annotation.rb', line 48 def fontColor @fontColor end |
#fontFamily ⇒ Object
Returns the value of attribute fontFamily.
45 46 47 |
# File 'lib/groupdocs/document/annotation.rb', line 45 def fontFamily @fontFamily end |
#fontSize ⇒ Object
Returns the value of attribute fontSize.
46 47 48 |
# File 'lib/groupdocs/document/annotation.rb', line 46 def fontSize @fontSize end |
#guid ⇒ Object
19 20 21 |
# File 'lib/groupdocs/document/annotation.rb', line 19 def guid @guid end |
#height ⇒ Object
Returns the value of attribute height.
42 43 44 |
# File 'lib/groupdocs/document/annotation.rb', line 42 def height @height end |
#id ⇒ Object
17 18 19 |
# File 'lib/groupdocs/document/annotation.rb', line 17 def id @id end |
#layerId ⇒ Object
69 70 71 |
# File 'lib/groupdocs/document/annotation.rb', line 69 def layerId @layerId end |
#pageNumber ⇒ Object
added in release 1.5.8
52 53 54 |
# File 'lib/groupdocs/document/annotation.rb', line 52 def pageNumber @pageNumber end |
#penColor ⇒ Object
added in release 1.7.0
59 60 61 |
# File 'lib/groupdocs/document/annotation.rb', line 59 def penColor @penColor end |
#penStyle ⇒ Object
63 64 65 |
# File 'lib/groupdocs/document/annotation.rb', line 63 def penStyle @penStyle end |
#penWidth ⇒ Object
61 62 63 |
# File 'lib/groupdocs/document/annotation.rb', line 61 def penWidth @penWidth end |
#replies ⇒ Object
37 38 39 |
# File 'lib/groupdocs/document/annotation.rb', line 37 def replies @replies end |
#replyGuid ⇒ Object
27 28 29 |
# File 'lib/groupdocs/document/annotation.rb', line 27 def replyGuid @replyGuid end |
#serverTime ⇒ Object
54 55 56 |
# File 'lib/groupdocs/document/annotation.rb', line 54 def serverTime @serverTime end |
#sessionGuid ⇒ Object
21 22 23 |
# File 'lib/groupdocs/document/annotation.rb', line 21 def sessionGuid @sessionGuid end |
#type ⇒ Symbol
Returns type in human-readable format.
31 32 33 |
# File 'lib/groupdocs/document/annotation.rb', line 31 def type @type end |
#width ⇒ Object
41 42 43 |
# File 'lib/groupdocs/document/annotation.rb', line 41 def width @width end |
Instance Method Details
#add_reply(reply) ⇒ Object
Adds reply to annotation.
193 194 195 196 197 198 199 |
# File 'lib/groupdocs/document/annotation.rb', line 193 def add_reply(reply) reply.is_a?(GroupDocs::Document::Annotation::Reply) or raise ArgumentError, "Reply should be GroupDocs::Document::Annotation::Reply object, received: #{reply.inspect}" @replies ||= Array.new @replies << reply end |
#create!(info, access = {}) ⇒ Object
Creates new annotation.
216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/groupdocs/document/annotation.rb', line 216 def create!(info, access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :POST request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/annotations" request[:request_body] = info end.execute! json.each do |field, value| send(:"#{field}=", value) if respond_to?(:"#{field}=") end end |
#created_on ⇒ Time
Converts timestamp which is return by API server to Time object.
155 156 157 |
# File 'lib/groupdocs/document/annotation.rb', line 155 def created_on Time.at(@createdOn / 1000) end |
#move!(x, y, access = {}) ⇒ Object
Moves annotation to given coordinates.
293 294 295 296 297 298 299 300 301 302 |
# File 'lib/groupdocs/document/annotation.rb', line 293 def move!(x, y, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/position" request[:request_body] = { :x => x, :y => y } end.execute! self.annotation_position = { :x => x, :y => y } end |
#move_marker!(marker, access = {}) ⇒ Object
Changed in release 1.5.8
Moves annotation marker to given coordinates.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/groupdocs/document/annotation.rb', line 314 def move_marker!(marker, access = {}) marker.is_a?(GroupDocs::Document::Annotation::MarkerPosition) or raise ArgumentError, "Marker should be GroupDocs::Document::Annotation::MarkerPosition object, received: #{marker.inspect}" Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/markerPosition" request[:request_body] = marker end.execute! if box && page_number box.x = marker.position[:x] box.y = marker.position[:y] page_number = marker.page else self.box = { :x => marker.position[:x], :y => marker.position[:y] } self.page_number = marker.page end end |
#remove!(access = {}) ⇒ Object
Removes annotation.
237 238 239 240 241 242 243 |
# File 'lib/groupdocs/document/annotation.rb', line 237 def remove!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :DELETE request[:path] = "/ant/{{client_id}}/annotations/#{guid}" end.execute! end |
#remove_annotations!(access = {}) ⇒ Object
added in release 1.6.0
Removes all annotations from document.
259 260 261 262 263 264 265 266 |
# File 'lib/groupdocs/document/annotation.rb', line 259 def remove_annotations!(access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :DELETE request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/annotations" end.execute! json[:delete_annotation_results] end |
#replies!(options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies..
280 281 282 |
# File 'lib/groupdocs/document/annotation.rb', line 280 def replies!( = {}, access = {}) Document::Annotation::Reply.get!(self, , access) end |
#resize!(x, y, access = {}) ⇒ Object
Resize annotation.
362 363 364 365 366 367 368 369 370 371 |
# File 'lib/groupdocs/document/annotation.rb', line 362 def resize!(x, y, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" request[:request_body] = { :width => x, :height => y } end.execute! self.box = { :width => x, :height => y } end |
#set_access!(mode, access = {}) ⇒ Object
Sets access mode.
342 343 344 345 346 347 348 349 350 351 |
# File 'lib/groupdocs/document/annotation.rb', line 342 def set_access!(mode, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/annotationAccess" request[:request_body] = %w(public private).index(mode.to_s) end.execute! self.access = mode end |
#text_color!(font_color, access = {}) ⇒ Object
Save Text Of Text Color.
404 405 406 407 408 409 410 411 412 413 |
# File 'lib/groupdocs/document/annotation.rb', line 404 def text_color!(font_color, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" request[:request_body] = { :fontColor => font_color } end.execute! self.fontColor = font_color end |
#text_info!(fieldText, fontFamily, fontSize, access = {}) ⇒ Object
Save Text Of Text Field.
383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'lib/groupdocs/document/annotation.rb', line 383 def text_info!(fieldText, fontFamily, fontSize, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/annotations/#{guid}/size" request[:request_body] = { :fieldText => fieldText, :fontFamily => fontFamily, :fontSize => fontSize } end.execute! self.fieldText = fieldText self.fontFamily = fontFamily self.fontSize = fontSize end |