class TrackerApi::Resources::Comment

Public Instance Methods

attachments(reload: false) click to toggle source

Provides a list of all the attachments on the comment.

@reload Boolean to reload the attachments @return [Array]

# 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) click to toggle source

@param [Hash] params attributes to create the comment with @return [Comment] newly created Comment

# 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
delete() click to toggle source
# 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) click to toggle source
# 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
save() click to toggle source
# 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