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: Reply
Constant Summary collapse
- TYPES =
%w(Text Area Point)
Instance Attribute Summary collapse
-
#access ⇒ Symbol
Converts access mode to human-readable format.
- #annotationPosition ⇒ Object (also: #annotation_position)
- #box ⇒ Object
- #createdOn ⇒ Object (also: #created_on)
- #document ⇒ Object
- #documentGuid ⇒ Object (also: #document_guid)
- #guid ⇒ Object
- #id ⇒ Object
- #replies ⇒ Object
- #replyGuid ⇒ Object (also: #reply_guid)
- #sessionGuid ⇒ Object (also: #session_guid)
-
#type ⇒ Symbol
Returns type in human-readable format.
Instance Method Summary collapse
-
#add_reply(reply) ⇒ Object
Adds reply to annotation.
-
#collaborators!(access = {}) ⇒ Array<GroupDocs::User>
Returns annotation collaborators.
-
#collaborators_set!(emails, access = {}) ⇒ Array<GroupDocs::User>
(also: #collaborators=)
Sets annotation collaborators to given emails.
-
#create!(access = {}) ⇒ Object
Creates new annotation.
-
#initialize(options = {}, &blk) ⇒ Annotation
constructor
Creates new GroupDocs::Document::Annotation.
-
#move!(x, y, access = {}) ⇒ Object
Moves annotation to given coordinates.
-
#remove!(access = {}) ⇒ Object
Removes annotation.
-
#replies!(options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies..
Methods inherited from Api::Entity
Constructor Details
#initialize(options = {}, &blk) ⇒ Annotation
Creates new GroupDocs::Document::Annotation.
56 57 58 59 60 |
# File 'lib/groupdocs/document/annotation.rb', line 56 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.
27 28 29 |
# File 'lib/groupdocs/document/annotation.rb', line 27 def access @access end |
#annotationPosition ⇒ Object Also known as: annotation_position
33 34 35 |
# File 'lib/groupdocs/document/annotation.rb', line 33 def annotationPosition @annotationPosition end |
#box ⇒ Object
29 30 31 |
# File 'lib/groupdocs/document/annotation.rb', line 29 def box @box end |
#createdOn ⇒ Object Also known as: created_on
23 24 25 |
# File 'lib/groupdocs/document/annotation.rb', line 23 def createdOn @createdOn end |
#document ⇒ Object
11 12 13 |
# File 'lib/groupdocs/document/annotation.rb', line 11 def document @document end |
#documentGuid ⇒ Object Also known as: document_guid
19 20 21 |
# File 'lib/groupdocs/document/annotation.rb', line 19 def documentGuid @documentGuid end |
#guid ⇒ Object
15 16 17 |
# File 'lib/groupdocs/document/annotation.rb', line 15 def guid @guid end |
#id ⇒ Object
13 14 15 |
# File 'lib/groupdocs/document/annotation.rb', line 13 def id @id end |
#replies ⇒ Object
31 32 33 |
# File 'lib/groupdocs/document/annotation.rb', line 31 def replies @replies end |
#replyGuid ⇒ Object Also known as: reply_guid
21 22 23 |
# File 'lib/groupdocs/document/annotation.rb', line 21 def replyGuid @replyGuid end |
#sessionGuid ⇒ Object Also known as: session_guid
17 18 19 |
# File 'lib/groupdocs/document/annotation.rb', line 17 def sessionGuid @sessionGuid end |
#type ⇒ Symbol
Returns type in human-readable format.
25 26 27 |
# File 'lib/groupdocs/document/annotation.rb', line 25 def type @type end |
Instance Method Details
#add_reply(reply) ⇒ Object
Adds reply to annotation.
147 148 149 150 151 152 153 |
# File 'lib/groupdocs/document/annotation.rb', line 147 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 |
#collaborators!(access = {}) ⇒ Array<GroupDocs::User>
Returns annotation collaborators.
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/groupdocs/document/annotation.rb', line 188 def collaborators!(access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/collaborators" end.execute! json[:collaborators].map do |collaborator| User.new(collaborator) end end |
#collaborators_set!(emails, access = {}) ⇒ Array<GroupDocs::User> Also known as: collaborators=
Sets annotation collaborators to given emails.
209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/groupdocs/document/annotation.rb', line 209 def collaborators_set!(emails, access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/files/#{document.file.guid}/collaborators" request[:request_body] = emails end.execute! json[:collaborators].map do |collaborator| User.new(collaborator) end end |
#create!(access = {}) ⇒ Object
Creates new annotation.
167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/groupdocs/document/annotation.rb', line 167 def create!(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] = to_hash end.execute! json.each do |field, value| send(:"#{field}=", value) if respond_to?(:"#{field}=") end end |
#move!(x, y, access = {}) ⇒ Object
Moves annotation to given coordinates.
264 265 266 267 268 269 270 271 272 273 |
# File 'lib/groupdocs/document/annotation.rb', line 264 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 |
#remove!(access = {}) ⇒ Object
Removes annotation.
231 232 233 234 235 236 237 |
# File 'lib/groupdocs/document/annotation.rb', line 231 def remove!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :DELETE request[:path] = "/ant/{{client_id}}/annotations/#{guid}" end.execute! end |
#replies!(options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies..
251 252 253 |
# File 'lib/groupdocs/document/annotation.rb', line 251 def replies!( = {}, access = {}) Document::Annotation::Reply.get!(self, , access) end |