Class: GroupDocs::Document::Annotation
- Inherits:
-
Api::Entity
- Object
- Api::Entity
- GroupDocs::Document::Annotation
- Defined in:
- lib/groupdocs/document/annotation.rb
Defined Under Namespace
Classes: Reply
Constant Summary collapse
- TYPES =
{ text: 0, area: 1, point: 2, }
Instance Attribute Summary collapse
- #access ⇒ Object
- #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 field type in human-readable format.
Instance Method Summary collapse
-
#add_reply(reply) ⇒ Object
Adds reply to annotation.
-
#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.
-
#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.
53 54 55 56 57 |
# File 'lib/groupdocs/document/annotation.rb', line 53 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 ⇒ Object
29 30 31 |
# File 'lib/groupdocs/document/annotation.rb', line 29 def access @access end |
#box ⇒ Object
31 32 33 |
# File 'lib/groupdocs/document/annotation.rb', line 31 def box @box end |
#createdOn ⇒ Object Also known as: created_on
25 26 27 |
# File 'lib/groupdocs/document/annotation.rb', line 25 def createdOn @createdOn end |
#document ⇒ Object
13 14 15 |
# File 'lib/groupdocs/document/annotation.rb', line 13 def document @document end |
#documentGuid ⇒ Object Also known as: document_guid
21 22 23 |
# File 'lib/groupdocs/document/annotation.rb', line 21 def documentGuid @documentGuid end |
#guid ⇒ Object
17 18 19 |
# File 'lib/groupdocs/document/annotation.rb', line 17 def guid @guid end |
#id ⇒ Object
15 16 17 |
# File 'lib/groupdocs/document/annotation.rb', line 15 def id @id end |
#replies ⇒ Object
33 34 35 |
# File 'lib/groupdocs/document/annotation.rb', line 33 def replies @replies end |
#replyGuid ⇒ Object Also known as: reply_guid
23 24 25 |
# File 'lib/groupdocs/document/annotation.rb', line 23 def replyGuid @replyGuid end |
#sessionGuid ⇒ Object Also known as: session_guid
19 20 21 |
# File 'lib/groupdocs/document/annotation.rb', line 19 def sessionGuid @sessionGuid end |
#type ⇒ Symbol
Returns field type in human-readable format.
27 28 29 |
# File 'lib/groupdocs/document/annotation.rb', line 27 def type @type end |
Instance Method Details
#add_reply(reply) ⇒ Object
Adds reply to annotation.
126 127 128 129 130 131 132 |
# File 'lib/groupdocs/document/annotation.rb', line 126 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_set!(emails, access = {}) ⇒ Array<GroupDocs::User> Also known as: collaborators=
Sets annotation collaborators to given emails.
168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/groupdocs/document/annotation.rb', line 168 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.
146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/groupdocs/document/annotation.rb', line 146 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 |
#remove!(access = {}) ⇒ Object
Removes annotation.
190 191 192 193 194 195 196 |
# File 'lib/groupdocs/document/annotation.rb', line 190 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..
210 211 212 |
# File 'lib/groupdocs/document/annotation.rb', line 210 def replies!( = {}, access = {}) Document::Annotation::Reply.get!(self, , access) end |