Annotation API - p0deje/groupdocs-ruby GitHub Wiki
Get document annotations
document = GroupDocs::Document.find!(:name, 'CV.doc')
doc.annotations!
#=> [#<GroupDocs::Document::Annotation:0x00000001762dd8 @guid="395487c859d3760f", @box=#<GroupDocs::Document::Rectangle:0x0000000169bf80>, @type=:text, @replies=[#<GroupDocs::Document::Annotation::Reply:0x000000016990a0 @guid="0ee8bacd", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="New", @replied_on=2011-09-22 05:26:37 +0700, @annotation=#<GroupDocs::Document::Annotation:0x00000001762dd8>>], @created_on=2011-09-19 23:27:57 +0700, @document=#<GroupDocs::Document:0x00000001455fc8>>]
Create new annotation for document
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = GroupDocs::Document::Annotation.new(document: document)
annotation.create!
Set collaborators for annotation
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
annotations.collaborators_set!(%w([email protected] [email protected]))
or
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
annotations.collaborators = %w([email protected] [email protected])
Remove annotation
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
annotations.remove!
Get all replies for annotation
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
annotations.replies!
#=> [#<GroupDocs::Document::Annotation::Reply:0x00000001981038 @guid="0ee8bacd", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="Reply 1", @replied_on=2011-09-22 05:26:37 +0700, @annotation=#<GroupDocs::Document::Annotation:0x000000018ad738>>, #<GroupDocs::Document::Annotation::Reply:0x0000000197e7e8 @guid="d27350b6", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="Reply 2", @replied_on=2011-09-22 21:47:20 +0700, @annotation=#<GroupDocs::Document::Annotation:0x000000018ad738>>]
or
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
GroupDocs::Document::Annotation::Reply.get!(annotation)
#=> [#<GroupDocs::Document::Annotation::Reply:0x00000001981038 @guid="0ee8bacd", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="Reply 1", @replied_on=2011-09-22 05:26:37 +0700, @annotation=#<GroupDocs::Document::Annotation:0x000000018ad738>>, #<GroupDocs::Document::Annotation::Reply:0x0000000197e7e8 @guid="d27350b6", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="Reply 2", @replied_on=2011-09-22 21:47:20 +0700, @annotation=#<GroupDocs::Document::Annotation:0x000000018ad738>>]
Get all replies for annotation since the beginning of 2012 year
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
annotations.replies!(after: Time.new(2012, 01, 01))
#=> [#<GroupDocs::Document::Annotation::Reply:0x0000000197e7e8 @guid="d27350b6", @user_guid="8f3b68ed784b2702", @user_name="[email protected]", @text="Reply 2", @replied_on=2012-01-02 21:47:20 +0700, @annotation=#<GroupDocs::Document::Annotation:0x000000018ad738>>]
Create new reply for annotation
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = GroupDocs::Document::Annotation.new(document: document)
reply = GroupDocs::Document::Annotation::Reply.new(annotation: annotation)
reply.text = "Reply text"
reply.create!
Edit reply
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
reply = annotation.replies!.first
reply.text = "New reply text"
reply.edit!
Remove reply (currently not implemented in API)
document = GroupDocs::Document.find!(:name, 'CV.doc')
annotation = document.annotations!.first
reply = annotation.replies!.first
reply.remove!