Class: TrackerApi::Resources::Comment
Defined Under Namespace
Classes: UpdateRepresenter
Instance Method Summary
collapse
included
Instance Method Details
#attachments(reload: false) ⇒ Array[FileAttachments]
Provides a list of all the attachments on the comment.
62
63
64
65
66
67
68
|
# File 'lib/tracker_api/resources/comment.rb', line 62
def attachments(reload: false)
if !reload && @file_attachments.present?
@file_attachments
else
@file_attachments = Endpoints::Attachment.new(client).get(self)
end
end
|
#create_attachments(params) ⇒ Comment
48
49
50
51
|
# File 'lib/tracker_api/resources/comment.rb', line 48
def create_attachments(params)
self.file_attachment_ids_to_add = Endpoints::Attachments.new(client).create(self, params[:files]).collect(&:id)
save
end
|
40
41
42
43
44
|
# File 'lib/tracker_api/resources/comment.rb', line 40
def delete
raise ArgumentError, 'Cannot delete a comment with an unknown story_id or epic_id.' if story_id.nil? && epic_id.nil?
Endpoints::Comment.new(client).delete(self)
end
|
#delete_attachments(attachment_ids = nil) ⇒ Object
53
54
55
56
|
# File 'lib/tracker_api/resources/comment.rb', line 53
def delete_attachments(attachment_ids = nil)
self.file_attachment_ids_to_remove = attachment_ids || attachments.collect(&:id)
save
end
|
34
35
36
37
38
|
# File 'lib/tracker_api/resources/comment.rb', line 34
def save
raise ArgumentError, 'Cannot update a comment with an unknown story_id or epic_id.' if story_id.nil? && epic_id.nil?
Endpoints::Comment.new(client).update(self, UpdateRepresenter.new(Comment.new(self.dirty_attributes)))
end
|