lib/groupdocs/document/annotation.rb in groupdocs-0.3.11 vs lib/groupdocs/document/annotation.rb in groupdocs-1.0.0
- old
+ new
@@ -1,7 +1,7 @@
module GroupDocs
- class Document::Annotation < GroupDocs::Api::Entity
+ class Document::Annotation < Api::Entity
require 'groupdocs/document/annotation/reply'
include Api::Helpers::AccessMode
@@ -15,10 +15,12 @@
attr_accessor :guid
# @attr [String] sessionGuid
attr_accessor :sessionGuid
# @attr [String] documentGuid
attr_accessor :documentGuid
+ # @attr [String] creatorGuid
+ attr_accessor :creatorGuid
# @attr [String] replyGuid
attr_accessor :replyGuid
# @attr [Time] createdOn
attr_accessor :createdOn
# @attr [Symbol] type
@@ -38,10 +40,12 @@
# Human-readable accessors
alias_method :session_guid, :sessionGuid
alias_method :session_guid=, :sessionGuid=
alias_method :document_guid, :documentGuid
alias_method :document_guid=, :documentGuid=
+ alias_method :creator_guid, :creatorGuid
+ alias_method :creator_guid=, :creatorGuid=
alias_method :reply_guid, :replyGuid
alias_method :reply_guid=, :replyGuid=
alias_method :created_on, :createdOn
alias_method :created_on=, :createdOn=
alias_method :annotation_position, :annotationPosition
@@ -154,11 +158,11 @@
#
# Creates new annotation.
#
# @example
- # document = GroupDocs::Document.find!(:name, 'CV.doc')
+ # document = GroupDocs::Storage::Folder.list!.first.to_document
# annotation = GroupDocs::Document::Annotation.new(document: document)
# annotation.create!
#
# @param [Hash] access Access credentials
# @option access [String] :client_id
@@ -268,9 +272,28 @@
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
+
+ #
+ # Sets access mode.
+ #
+ # @param [Symbol] mode
+ # @param [Hash] access Access credentials
+ # @option access [String] :client_id
+ # @option access [String] :private_key
+ #
+ 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
end # Document::Annotation
end # GroupDocs