lib/groupdocs/document/annotation/reply.rb in groupdocs-0.3.11 vs lib/groupdocs/document/annotation/reply.rb in groupdocs-1.0.0
- old
+ new
@@ -1,7 +1,7 @@
module GroupDocs
- class Document::Annotation::Reply < GroupDocs::Api::Entity
+ class Document::Annotation::Reply < Api::Entity
#
# Return an array of replies for given annotation.
#
# @param [GroupDocs::Document::Annotation] annotation
@@ -86,39 +86,37 @@
#
# Creates reply.
#
# @example
- # document = GroupDocs::Document.find!(:name, 'CV.doc')
- # annotation = GroupDocs::Document::Annotation.new(document: document)
+ # document = GroupDocs::Storage::Folder.list!.first.to_document
+ # annotation = document.annotations!.first
# reply = GroupDocs::Document::Annotation::Reply.new(annotation: annotation)
# reply.text = "Reply text"
# reply.create!
#
# @param [Hash] access Access credentials
# @option access [String] :client_id
# @option access [String] :private_key
#
- # @raise [NameError] if annotation or annotation_guid are not set
- #
def create!(access = {})
json = Api::Request.new do |request|
request[:access] = access
request[:method] = :POST
request[:path] = "/ant/{{client_id}}/annotations/#{get_annotation_guid}/replies"
- request[:request_body] = text
+ request[:request_body] = { text: text }
end.execute!
self.guid = json[:replyGuid]
self.annotation_guid = json[:annotationGuid]
end
#
# Edits reply.
#
# @example
- # document = GroupDocs::Document.find!(:name, 'CV.doc')
+ # document = GroupDocs::Storage::Folder.list!.first.to_document
# annotation = document.annotations!.first
# reply = annotation.replies!.first
# reply.text = "New reply text"
# reply.edit!
#
@@ -140,12 +138,10 @@
#
# @param [Hash] access Access credentials
# @option access [String] :client_id
# @option access [String] :private_key
#
- # @todo currently not implemented in API
- #
def remove!(access = {})
Api::Request.new do |request|
request[:access] = access
request[:method] = :DELETE
request[:path] = "/ant/{{client_id}}/replies/#{guid}"
@@ -155,10 +151,10 @@
private
#
# Returns annotation guid.
#
- # @returns [String]
+ # @return [String]
#
def get_annotation_guid
annotation_guid || annotation.guid
end