Module: Teamlab::CommunityBlogs
- Included in:
- Community
- Defined in:
- lib/teamlab/modules/community/community_blogs.rb
Overview
Methods for working with community blogs
Instance Method Summary collapse
- #add_comment(post_id, content, options = {}) ⇒ Object
- #create_post(title, content, options = {}) ⇒ Object
- #delete_post(post_id) ⇒ Object
- #get_all_posts ⇒ Object
- #get_blog_tags ⇒ Object
- #get_comments(post_id) ⇒ Object
- #get_my_posts ⇒ Object
- #get_post(post_id) ⇒ Object
- #get_posts_by_tag(tag) ⇒ Object
- #get_user_posts(username) ⇒ Object
- #search_posts(query) ⇒ Object
- #update_post(post_id, title, content, options = {}) ⇒ Object
Instance Method Details
#add_comment(post_id, content, options = {}) ⇒ Object
42 43 44 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 42 def add_comment(post_id, content, = {}) @request.post(['blog', post_id.to_s, 'comment'], { content: content }.merge()) end |
#create_post(title, content, options = {}) ⇒ Object
38 39 40 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 38 def create_post(title, content, = {}) @request.post(%w[blog], { title: title, content: content }.merge()) end |
#delete_post(post_id) ⇒ Object
50 51 52 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 50 def delete_post(post_id) @request.delete(['blog', post_id.to_s]) end |
#get_all_posts ⇒ Object
6 7 8 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 6 def get_all_posts @request.get(%w[blog]) end |
#get_blog_tags ⇒ Object
10 11 12 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 10 def @request.get(%w[blog tag]) end |
#get_comments(post_id) ⇒ Object
34 35 36 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 34 def get_comments(post_id) @request.get(['blog', post_id.to_s, 'comment']) end |
#get_my_posts ⇒ Object
14 15 16 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 14 def get_my_posts @request.get(%w[blog @self]) end |
#get_post(post_id) ⇒ Object
18 19 20 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 18 def get_post(post_id) @request.get(['blog', post_id.to_s]) end |
#get_posts_by_tag(tag) ⇒ Object
22 23 24 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 22 def get_posts_by_tag(tag) @request.get(['blog', 'tag', tag.to_s]) end |
#get_user_posts(username) ⇒ Object
30 31 32 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 30 def get_user_posts(username) @request.get(['blog', 'user', username.to_s]) end |
#search_posts(query) ⇒ Object
26 27 28 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 26 def search_posts(query) @request.get(['blog', '@search', query.to_s]) end |
#update_post(post_id, title, content, options = {}) ⇒ Object
46 47 48 |
# File 'lib/teamlab/modules/community/community_blogs.rb', line 46 def update_post(post_id, title, content, = {}) @request.put(['blog', post_id.to_s], { title: title, content: content }.merge()) end |