Module: Teamlab::ProjectsDiscussions

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

Overview

Module for projects discussions methods

Instance Method Summary collapse

Instance Method Details

#add_message(project_id, title, content, participants, options = {}) ⇒ Object



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

def add_message(project_id, title, content, participants, options = {})
  @request.post([project_id.to_s, 'message'], { title: title, content: content, participants: participants }.merge(options))
end

#check_subscription_to_discussion(message_id) ⇒ Object



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

def check_subscription_to_discussion(message_id)
  @request.get(['message', message_id.to_s, 'subscribe'])
end

#delete_message(message_id) ⇒ Object



49
50
51
# File 'lib/teamlab/modules/projects/projects_discussions.rb', line 49

def delete_message(message_id)
  @request.delete(['message', message_id.to_s])
end

#discussion_subscribers(message_id) ⇒ Array

Returns a list of all the subscribers of the discussion with the selected message

Parameters:

  • message_id (Integer, String)

    Message ID

Returns:

  • (Array)

    List of subscibers



45
46
47
# File 'lib/teamlab/modules/projects/projects_discussions.rb', line 45

def discussion_subscribers(message_id)
  @request.get(['message', message_id.to_s, 'subscribes'])
end

#get_latest_discussion_messagesObject



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

def get_latest_discussion_messages
  @request.get(['message'])
end

#get_message_by_filter(options = {}) ⇒ Object



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

def get_message_by_filter(options = {})
  @request.get(%w[message filter], options)
end

#get_messages(project_id) ⇒ Object



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

def get_messages(project_id)
  @request.get([project_id.to_s, 'message'])
end

#get_project_message(message_id) ⇒ Object



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

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

#preview_of_discussion_message(htmltext) ⇒ Hash

Returns a preview of the discussion message

Parameters:

  • Message (String)

    text in the HTML format

Returns:

  • (Hash)

    Message preview



56
57
58
# File 'lib/teamlab/modules/projects/projects_discussions.rb', line 56

def preview_of_discussion_message(htmltext)
  @request.post(%w[message discussion preview], htmltext: htmltext)
end

#subscribe_to_message_action(message_id) ⇒ Object



38
39
40
# File 'lib/teamlab/modules/projects/projects_discussions.rb', line 38

def subscribe_to_message_action(message_id)
  @request.put(['message', message_id.to_s, 'subscribe'])
end

#update_message(message_id, project_id, title, content, options = {}) ⇒ Object



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

def update_message(message_id, project_id, title, content, options = {})
  @request.put(['message', message_id.to_s], { projectid: project_id, title: title, content: content }.merge(options))
end

#update_message_status(message_id, status) ⇒ Object



34
35
36
# File 'lib/teamlab/modules/projects/projects_discussions.rb', line 34

def update_message_status(message_id, status)
  @request.put(['message', message_id.to_s, 'status'], status: status)
end