Module: Teamlab::CommunityForums

Included in:
Community
Defined in:
lib/teamlab/modules/community/community_forums.rb

Overview

Methods for working with community forums

Instance Method Summary collapse

Instance Method Details

#add_post_to_topic(topic_id, subject, content, options = {}) ⇒ Object



34
35
36
# File 'lib/teamlab/modules/community/community_forums.rb', line 34

def add_post_to_topic(topic_id, subject, content, options = {})
  @request.post(['forum', 'topic', topic_id.to_s], { subject: subject, content: content }.merge(options))
end

#add_thread_to_category(category_id, category_name, thread_name, description) ⇒ Object



26
27
28
# File 'lib/teamlab/modules/community/community_forums.rb', line 26

def add_thread_to_category(category_id, category_name, thread_name, description)
  @request.post(%w[forum], categoryId: category_id, categoryName: category_name.to_s, threadName: thread_name, threadDescription: description)
end

#add_topic_to_thread(thread_id, subject, content, options = {}) ⇒ Object



30
31
32
# File 'lib/teamlab/modules/community/community_forums.rb', line 30

def add_topic_to_thread(thread_id, subject, content, options = {})
  @request.post(['forum', thread_id], { subject: subject, content: content }.merge(options))
end

#delete_category(category_id) ⇒ Teamlab::Response

Returns result of delete.

Parameters:

  • category_id (Integer)

    category to delete

Returns:



66
67
68
# File 'lib/teamlab/modules/community/community_forums.rb', line 66

def delete_category(category_id)
  @request.delete(['forum', 'category', category_id.to_s])
end

#delete_forum_post(post_id) ⇒ Teamlab::Response

Returns result of delete.

Parameters:

  • post_id (Integer)

    post to delete

Returns:



48
49
50
# File 'lib/teamlab/modules/community/community_forums.rb', line 48

def delete_forum_post(post_id)
  @request.delete(['forum', 'post', post_id.to_s])
end

#delete_forum_topic(topic_id) ⇒ Teamlab::Response

Returns result of delete.

Parameters:

  • topic_id (Integer)

    topic to delete

Returns:



54
55
56
# File 'lib/teamlab/modules/community/community_forums.rb', line 54

def delete_forum_topic(topic_id)
  @request.delete(['forum', 'topic', topic_id.to_s])
end

#delete_thread(thread_id) ⇒ Teamlab::Response

Returns result of delete.

Parameters:

  • thread_id (Integer)

    thread to delete

Returns:



60
61
62
# File 'lib/teamlab/modules/community/community_forums.rb', line 60

def delete_thread(thread_id)
  @request.delete(['forum', 'thread', thread_id.to_s])
end

#get_forumsObject



6
7
8
# File 'lib/teamlab/modules/community/community_forums.rb', line 6

def get_forums
  @request.get(%w[forum])
end

#get_last_updated_topicsObject



14
15
16
# File 'lib/teamlab/modules/community/community_forums.rb', line 14

def get_last_updated_topics
  @request.get(%w[forum topic recent])
end

#get_posts(topic_id) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/community/community_forums.rb', line 18

def get_posts(topic_id)
  @request.get(['forum', 'topic', topic_id.to_s])
end

#get_thread_topics(id) ⇒ Object



10
11
12
# File 'lib/teamlab/modules/community/community_forums.rb', line 10

def get_thread_topics(id)
  @request.get(['forum', id.to_s])
end

#search_topics(query) ⇒ Object



22
23
24
# File 'lib/teamlab/modules/community/community_forums.rb', line 22

def search_topics(query)
  @request.get(['forum', '@search', query.to_s])
end

#update_post_in_topic(topic_id, post_id, options = {}) ⇒ Object



42
43
44
# File 'lib/teamlab/modules/community/community_forums.rb', line 42

def update_post_in_topic(topic_id, post_id, options = {})
  @request.put(['forum', 'topic', topic_id.to_s, post_id.to_s], options)
end

#update_topic_in_thread(topic_id, subject, options = {}) ⇒ Object



38
39
40
# File 'lib/teamlab/modules/community/community_forums.rb', line 38

def update_topic_in_thread(topic_id, subject, options = {})
  @request.put(['forum', 'topic', topic_id.to_s], { subject: subject }.merge(options))
end