Module: WordpressApi::Api::Writer

Included in:
Client
Defined in:
lib/wordpress_api/api/writer.rb

Instance Method Summary collapse

Instance Method Details

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



21
22
23
24
# File 'lib/wordpress_api/api/writer.rb', line 21

def create_comment blog_id, post_id, content, options={}
  path = "/sites/#{blog_id}/posts/#{post_id}/replies/new"
  Mash.from_json(post path, content.to_json, options)
end

#create_comment_tree(blog_id, comment_id, content, options = {}) ⇒ Object



26
27
28
29
# File 'lib/wordpress_api/api/writer.rb', line 26

def create_comment_tree blog_id, comment_id, content, options={}
  path = "/sites/#{blog_id}/comments/#{comment_id}/replies/new"
  Mash.from_json(post path, content.to_json, options)
end

#create_like(blog_id, post_id, options = {}) ⇒ Object



36
37
38
39
# File 'lib/wordpress_api/api/writer.rb', line 36

def create_like blog_id, post_id, options={}
  path = "/sites/#{blog_id}/posts/#{post_id}/likes/new"
  Mash.from_json(post path, "", options)
end

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



6
7
8
9
# File 'lib/wordpress_api/api/writer.rb', line 6

def create_post blog_id, content, options={}
  path = "/sites/#{blog_id}/posts/new"
  Mash.from_json(post(path, content.to_json, options))
end

#delete_comment(blog_id, comment_id, options = {}) ⇒ Object



31
32
33
34
# File 'lib/wordpress_api/api/writer.rb', line 31

def delete_comment blog_id, comment_id, options={}
  path = "/sites/#{blog_id}/comments/#{comment_id}/delete"
  Mash.from_json(post path, "", options)
end

#delete_like(blog_id, post_id, options = {}) ⇒ Object



41
42
43
44
# File 'lib/wordpress_api/api/writer.rb', line 41

def delete_like blog_id, post_id, options={}
  path = "/sites/#{blog_id}/posts/#{post_id}/likes/mine/delete"
  Mash.from_json(post path, "", options)
end

#delete_post(blog_id, post_id, options = {}) ⇒ Object



11
12
13
14
# File 'lib/wordpress_api/api/writer.rb', line 11

def delete_post blog_id, post_id, options={}
  path = "/sites/#{blog_id}/posts/#{post_id}/delete"
  Mash.from_json(post(path, "", options))
end

#follow(blog_id, options = {}) ⇒ Object



46
47
48
49
# File 'lib/wordpress_api/api/writer.rb', line 46

def follow blog_id, options={}
  path = "/sites/#{blog_id}/follows/new"
  Mash.from_json(post(path, "", options))
end

#repost(blog_id, post_id, options = {}) ⇒ Object



16
17
18
19
# File 'lib/wordpress_api/api/writer.rb', line 16

def repost blog_id, post_id, options={}
  path = "/sites/#{blog_id}/posts/#{post_id}/reblogs/new"
  Mash.from_json(post path, "", options)
end

#unfollow(blog_id, options = {}) ⇒ Object



51
52
53
54
# File 'lib/wordpress_api/api/writer.rb', line 51

def unfollow blog_id, options={}
  path = "/sites/#{blog_id}/follows/mine/delete"
  Mash.from_json(post(path, "", options))
end