Module: Teamlab::CommunityWiki

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

Overview

Methods for working with community wikis

Instance Method Summary collapse

Instance Method Details

#create_page(name, body) ⇒ Object



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

def create_page(name, body)
  @request.post(%w[wiki], name: name.to_s, body: body.to_s)
end

#create_wiki_page_comment(page_name, content, options = {}) ⇒ Object



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

def create_wiki_page_comment(page_name, content, options = {})
  @request.post(['wiki', page_name.to_s, 'comment'], { content: content.to_s }.merge(options))
end

#delete_wiki_file(name) ⇒ Object



58
59
60
# File 'lib/teamlab/modules/community/community_wiki.rb', line 58

def delete_wiki_file(name)
  @request.delete(['wiki', 'file', name.to_s])
end

#delete_wiki_page(name) ⇒ Object



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

def delete_wiki_page(name)
  @request.delete(['wiki', name.to_s])
end

#delete_wiki_page_comment(id) ⇒ Object



62
63
64
# File 'lib/teamlab/modules/community/community_wiki.rb', line 62

def delete_wiki_page_comment(id)
  @request.delete(['wiki', 'comment', id.to_s])
end

#get_all_page_comments(page_name) ⇒ Object



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

def get_all_page_comments(page_name)
  @request.get(['wiki', page_name.to_s, 'comment'])
end

#get_page_history(name) ⇒ Object



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

def get_page_history(name)
  @request.get(['wiki', name.to_s, 'story'])
end

#get_wiki_file_info(name) ⇒ Object



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

def get_wiki_file_info(name)
  @request.get(['wiki', 'file', name.to_s])
end

#get_wiki_page(name, options = {}) ⇒ Object



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

def get_wiki_page(name, options = {})
  @request.get(['wiki', name], options)
end

#get_wiki_pagesObject



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

def get_wiki_pages
  @request.get(%w[wiki])
end

#search_wiki_pages_by_content(content) ⇒ Object



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

def search_wiki_pages_by_content(content)
  @request.get(['wiki', 'search', 'bycontent', content.to_s])
end

#search_wiki_pages_by_name(name) ⇒ Object



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

def search_wiki_pages_by_name(name)
  @request.get(['wiki', 'search', 'byname', name.to_s])
end

#update_wiki_page(name, body) ⇒ Object



46
47
48
# File 'lib/teamlab/modules/community/community_wiki.rb', line 46

def update_wiki_page(name, body)
  @request.put(['wiki', name.to_s], body: body.to_s)
end

#update_wiki_page_comment(comment_id, body) ⇒ Object



50
51
52
# File 'lib/teamlab/modules/community/community_wiki.rb', line 50

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

#upload_files(file) ⇒ Object



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

def upload_files(file)
  @request.post(%w[wiki file], somefile: File.new(file))
end