Class: GroupDocs::Document::Annotation::Reply
- Inherits:
-
Api::Entity
- Object
- Api::Entity
- GroupDocs::Document::Annotation::Reply
- Defined in:
- lib/groupdocs/document/annotation/reply.rb
Instance Attribute Summary collapse
- #annotation ⇒ Object
- #annotationGuid ⇒ Object
- #guid ⇒ Object
- #isAvatarExist ⇒ Object
-
#parentReplyGuid ⇒ Object
added in release 1.5.8.
- #repliedOn ⇒ Object
- #text ⇒ Object
-
#userEmail ⇒ Object
added in release 1.6.0.
- #userGuid ⇒ Object
- #userName ⇒ Object
Class Method Summary collapse
-
.get!(annotation, options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies for given annotation.
Instance Method Summary collapse
-
#create!(access = {}) ⇒ Object
Creates reply.
-
#edit!(access = {}) ⇒ Object
Edits reply.
-
#initialize(options = {}, &blk) ⇒ Reply
constructor
Creates new GroupDocs::Document::Annotation.
-
#remove!(access = {}) ⇒ Object
Removes reply.
-
#replied_on ⇒ Time
Converts timestamp which is return by API server to Time object.
Methods inherited from Api::Entity
Methods included from Api::Helpers::Accessor
Constructor Details
#initialize(options = {}, &blk) ⇒ Reply
Creates new GroupDocs::Document::Annotation.
82 83 84 85 86 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 82 def initialize( = {}, &blk) super(, &blk) annotation.is_a?(GroupDocs::Document::Annotation) or raise ArgumentError, "You have to pass GroupDocs::Document::Annotation object: #{annotation.inspect}." end |
Instance Attribute Details
#annotation ⇒ Object
41 42 43 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 41 def annotation @annotation end |
#annotationGuid ⇒ Object
47 48 49 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 47 def annotationGuid @annotationGuid end |
#guid ⇒ Object
45 46 47 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 45 def guid @guid end |
#isAvatarExist ⇒ Object
59 60 61 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 59 def isAvatarExist @isAvatarExist end |
#parentReplyGuid ⇒ Object
added in release 1.5.8
57 58 59 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 57 def parentReplyGuid @parentReplyGuid end |
#repliedOn ⇒ Object
53 54 55 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 53 def repliedOn @repliedOn end |
#text ⇒ Object
43 44 45 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 43 def text @text end |
#userEmail ⇒ Object
added in release 1.6.0
63 64 65 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 63 def userEmail @userEmail end |
#userGuid ⇒ Object
49 50 51 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 49 def userGuid @userGuid end |
#userName ⇒ Object
51 52 53 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 51 def userName @userName end |
Class Method Details
.get!(annotation, options = {}, access = {}) ⇒ Array<GroupDocs::Document::Annotation::Reply>
Return an array of replies for given annotation.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 18 def self.get!(annotation, = {}, access = {}) annotation.is_a?(GroupDocs::Document::Annotation) or raise ArgumentError, "You have to pass GroupDocs::Document::Annotation object: #{annotation.inspect}." ([:after] && ![:after].is_a?(Time)) and raise ArgumentError, "Option :after should be an instance of Time, received: #{[:after].inspect}" [:after] = ([:after].to_i * 1000) if [:after] api = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/ant/{{client_id}}/annotations/#{annotation.guid}/replies" end api.add_params() json = api.execute! json[:replies].map do |reply| reply.merge!(:annotation => annotation) Document::Annotation::Reply.new(reply) end end |
Instance Method Details
#create!(access = {}) ⇒ Object
Creates reply.
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 111 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 => text } end.execute! self.guid = json[:replyGuid] self.annotation_guid = json[:annotationGuid] end |
#edit!(access = {}) ⇒ Object
Edits reply.
137 138 139 140 141 142 143 144 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 137 def edit!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/ant/{{client_id}}/replies/#{guid}" request[:request_body] = text end.execute! end |
#remove!(access = {}) ⇒ Object
Removes reply.
153 154 155 156 157 158 159 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 153 def remove!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :DELETE request[:path] = "/ant/{{client_id}}/replies/#{guid}" end.execute! end |
#replied_on ⇒ Time
Converts timestamp which is return by API server to Time object.
93 94 95 |
# File 'lib/groupdocs/document/annotation/reply.rb', line 93 def replied_on Time.at(@repliedOn / 1000) end |