Module: Teamlab::ProjectsComments

Included in:
Project
Defined in:
lib/teamlab/modules/projects/projects_comments.rb

Overview

Module for projects comments methods

Instance Method Summary collapse

Instance Method Details

#add_message_comment(message_id, content, options = {}) ⇒ Object



22
23
24
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 22

def add_message_comment(message_id, content, options = {})
  @request.post(['message', message_id.to_s, 'comment'], { content: content }.merge(options))
end

#add_project_comment(entity_id, content, type, options = {}) ⇒ Hash

Adds a project comment with the parameters specified in the request

Parameters:

  • entity_id (String)

    Entity ID

  • content (String)

    Comment text

  • type (String, Symbol)

    Comment type (message or task)

Returns:

  • (Hash)

    Comment information



39
40
41
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 39

def add_project_comment(entity_id, content, type, options = {})
  @request.post(%w[comment], { entityid: entity_id, content: content, type: type.to_s }.merge(options))
end

#add_task_comment(task_id, content, options = {}) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 18

def add_task_comment(task_id, content, options = {})
  @request.post(['task', task_id.to_s, 'comment'], { content: content }.merge(options))
end

#delete_comment(comment_id) ⇒ Object



30
31
32
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 30

def delete_comment(comment_id)
  @request.delete(['comment', comment_id.to_s])
end

#get_a_comment_preview(htmltext, options = {}) ⇒ Hash

Get a preview of a project comment with the ID specified in the request

Parameters:

  • htmltext (String)

    Comment text in the HTML format

Returns:

  • (Hash)

    Comment information



46
47
48
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 46

def get_a_comment_preview(htmltext, options = {})
  @request.post(%w[comment preview], { htmltext: htmltext }.merge(options))
end

#get_comment(comment_id) ⇒ Object



6
7
8
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 6

def get_comment(comment_id)
  @request.get(['comment', comment_id.to_s])
end

#get_message_comments(message_id) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 14

def get_message_comments(message_id)
  @request.get(['message', message_id.to_s, 'comment'])
end

#get_task_comments(task_id) ⇒ Object



10
11
12
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 10

def get_task_comments(task_id)
  @request.get(['task', task_id.to_s, 'comment'])
end

#update_comment(comment_id, content) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/projects/projects_comments.rb', line 26

def update_comment(comment_id, content)
  @request.put(['comment', comment_id.to_s], content: content)
end