Class: Teamlab::Community

Inherits:
Object
  • Object
show all
Defined in:
lib/teamlab/modules/community.rb

Instance Method Summary collapse

Constructor Details

#initializeCommunity

Returns a new instance of Community.



3
4
5
# File 'lib/teamlab/modules/community.rb', line 3

def initialize
  @request = Teamlab::Request.new('community')
end

Instance Method Details

#add_bookmark(url, title, options = {}) ⇒ Object



95
96
97
# File 'lib/teamlab/modules/community.rb', line 95

def add_bookmark(url, title, options = {})
  @request.post(%w(bookmark), { url: url, title: title }.merge(options))
end

#add_comment(post_id, content, options = {}) ⇒ Object



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

def add_comment(post_id, content, options = {})
  @request.post(['blog', post_id.to_s, 'comment'], { content: content }.merge(options))
end

#add_comment_to_bookmark(bookmark_id, content, options = {}) ⇒ Object



99
100
101
# File 'lib/teamlab/modules/community.rb', line 99

def add_comment_to_bookmark(bookmark_id, content, options = {})
  @request.post(['bookmark', bookmark_id.to_s, 'comment'], { content: content }.merge(options))
end

#add_comment_to_event(event_id, content, options = {}) ⇒ Object



131
132
133
# File 'lib/teamlab/modules/community.rb', line 131

def add_comment_to_event(event_id, content, options = {})
  @request.post(['event', event_id.to_s, 'comment'], { content: content }.merge(options))
end

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



169
170
171
# File 'lib/teamlab/modules/community.rb', line 169

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

TODO: ERROR


161
162
163
# File 'lib/teamlab/modules/community.rb', line 161

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



165
166
167
# File 'lib/teamlab/modules/community.rb', line 165

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

#create_event(title, content, options = {}) ⇒ Object



123
124
125
# File 'lib/teamlab/modules/community.rb', line 123

def create_event(title, content, options = {})
  @request.post(%w(event), { title: title, content: content }.merge(options))
end

#create_page(name, body) ⇒ Object



213
214
215
# File 'lib/teamlab/modules/community.rb', line 213

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

#create_post(title, content, options = {}) ⇒ Object



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

def create_post(title, content, options = {})
  @request.post(%w(blog), { title: title, content: content }.merge(options))
end

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



221
222
223
# File 'lib/teamlab/modules/community.rb', line 221

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_post(post_id) ⇒ Object



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

def delete_post(post_id)
  @request.delete(['blog', post_id.to_s])
end

#delete_post_in_topic(topic_id, post_id) ⇒ Object



181
182
183
# File 'lib/teamlab/modules/community.rb', line 181

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

#delete_wiki_file(name) ⇒ Object



237
238
239
# File 'lib/teamlab/modules/community.rb', line 237

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

#delete_wiki_page(name) ⇒ Object



233
234
235
# File 'lib/teamlab/modules/community.rb', line 233

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

#delete_wiki_page_comment(id) ⇒ Object



241
242
243
# File 'lib/teamlab/modules/community.rb', line 241

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

#get_all_bookmark_tagsObject



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

def get_all_bookmark_tags
  @request.get(%w(bookmark tag))
end

#get_all_bookmarksObject



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

def get_all_bookmarks
  @request.get(%w(bookmark))
end

#get_all_eventsObject



103
104
105
# File 'lib/teamlab/modules/community.rb', line 103

def get_all_events
  @request.get(%w(event))
end

#get_all_page_comments(page_name) ⇒ Object



201
202
203
# File 'lib/teamlab/modules/community.rb', line 201

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

#get_all_postsObject



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

def get_all_posts
  @request.get(%w(blog))
end

#get_blog_tagsObject



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

def get_blog_tags
  @request.get(%w(blog tag))
end

#get_bookmark(id) ⇒ Object



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

def get_bookmark(id)
  @request.get(['bookmark', id.to_s])
end

#get_bookmark_comments(bookmark_id) ⇒ Object



87
88
89
# File 'lib/teamlab/modules/community.rb', line 87

def get_bookmark_comments(bookmark_id)
  @request.get(['bookmark', bookmark_id.to_s, 'comment'])
end

#get_bookmarks_added_by_meObject



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

def get_bookmarks_added_by_me
  @request.get(%w(bookmark @self))
end

#get_bookmarks_by_tag(tag) ⇒ Object



79
80
81
# File 'lib/teamlab/modules/community.rb', line 79

def get_bookmarks_by_tag(tag)
  @request.get(['bookmark', 'tag', tag.to_s])
end

#get_comments(post_id) ⇒ Object



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

def get_comments(post_id)
  @request.get(['blog', post_id.to_s, 'comment'])
end

#get_event(id) ⇒ Object



111
112
113
# File 'lib/teamlab/modules/community.rb', line 111

def get_event(id)
  @request.get(['event', id.to_s])
end

#get_event_comments(event_id) ⇒ Object



119
120
121
# File 'lib/teamlab/modules/community.rb', line 119

def get_event_comments(event_id)
  @request.get(['event', event_id.to_s, 'comment'])
end

#get_forumsObject



139
140
141
# File 'lib/teamlab/modules/community.rb', line 139

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

#get_last_updated_topicsObject



147
148
149
# File 'lib/teamlab/modules/community.rb', line 147

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

#get_my_eventsObject



107
108
109
# File 'lib/teamlab/modules/community.rb', line 107

def get_my_events
  @request.get(%w(event @self))
end

#get_my_favourite_bookmarksObject



71
72
73
# File 'lib/teamlab/modules/community.rb', line 71

def get_my_favourite_bookmarks
  @request.get(%w(bookmark @favs))
end

#get_my_postsObject



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

def get_my_posts
  @request.get(%w(blog @self))
end

#get_page_history(name) ⇒ Object



197
198
199
# File 'lib/teamlab/modules/community.rb', line 197

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

#get_post(post_id) ⇒ Object



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

def get_post(post_id)
  @request.get(['blog', post_id.to_s])
end

#get_posts(topic_id) ⇒ Object



151
152
153
# File 'lib/teamlab/modules/community.rb', line 151

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

#get_posts_by_tag(tag) ⇒ Object



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

def get_posts_by_tag(tag)
  @request.get(['blog', 'tag', tag.to_s])
end

#get_recently_added_bookmarksObject



83
84
85
# File 'lib/teamlab/modules/community.rb', line 83

def get_recently_added_bookmarks
  @request.get(%w(bookmark top recent))
end

#get_thread_topics(id) ⇒ Object



143
144
145
# File 'lib/teamlab/modules/community.rb', line 143

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

#get_user_posts(username) ⇒ Object



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

def get_user_posts(username)
  @request.get(['blog', 'user', username.to_s])
end

#get_wiki_file_info(name) ⇒ Object



193
194
195
# File 'lib/teamlab/modules/community.rb', line 193

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

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



189
190
191
# File 'lib/teamlab/modules/community.rb', line 189

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

#get_wiki_pagesObject



185
186
187
# File 'lib/teamlab/modules/community.rb', line 185

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

#search_bookmarks(queue) ⇒ Object



91
92
93
# File 'lib/teamlab/modules/community.rb', line 91

def search_bookmarks(queue)
  @request.get(['bookmark', '@search', queue.to_s])
end

#search_events(query) ⇒ Object



115
116
117
# File 'lib/teamlab/modules/community.rb', line 115

def search_events(query)
  @request.get(['event', '@search', query])
end

#search_posts(query) ⇒ Object



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

def search_posts(query)
  @request.get(['blog', '@search', query.to_s])
end

#search_topics(query) ⇒ Object



155
156
157
# File 'lib/teamlab/modules/community.rb', line 155

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

#search_wiki_pages_by_content(content) ⇒ Object



209
210
211
# File 'lib/teamlab/modules/community.rb', line 209

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

#search_wiki_pages_by_name(name) ⇒ Object



205
206
207
# File 'lib/teamlab/modules/community.rb', line 205

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

#update_event(event_id, title, content, options = {}) ⇒ Object



135
136
137
# File 'lib/teamlab/modules/community.rb', line 135

def update_event(event_id, title, content, options = {})
  @request.put(['event', event_id.to_s], { title: title, content: content }.merge(options))
end

#update_post(post_id, title, content, options = {}) ⇒ Object



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

def update_post(post_id, title, content, options = {})
  @request.put(['blog', post_id.to_s], { title: title, content: content }.merge(options))
end

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



177
178
179
# File 'lib/teamlab/modules/community.rb', line 177

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



173
174
175
# File 'lib/teamlab/modules/community.rb', line 173

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

#update_wiki_page(name, body) ⇒ Object



225
226
227
# File 'lib/teamlab/modules/community.rb', line 225

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



229
230
231
# File 'lib/teamlab/modules/community.rb', line 229

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

#upload_files(file) ⇒ Object



217
218
219
# File 'lib/teamlab/modules/community.rb', line 217

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

#vote_for_event(event_id, *variants) ⇒ Object



127
128
129
# File 'lib/teamlab/modules/community.rb', line 127

def vote_for_event(event_id, *variants)
  @request.post(['event', event_id.to_s, 'vote'], variants: variants.flatten)
end