Module: DiscourseApi::API::Posts

Included in:
Client
Defined in:
lib/discourse_api/api/posts.rb

Instance Method Summary collapse

Instance Method Details

#create_post(args) ⇒ Object



4
5
6
7
8
# File 'lib/discourse_api/api/posts.rb', line 4

def create_post(args)
  args = API.params(args)
            .required(:topic_id, :raw)
  post("/posts", args)
end

#edit_post(id, raw) ⇒ Object



21
22
23
# File 'lib/discourse_api/api/posts.rb', line 21

def edit_post(id, raw)
  put("/posts/#{id}", post: {raw: raw})
end

#get_post(id, args = {}) ⇒ Object



10
11
12
13
14
15
# File 'lib/discourse_api/api/posts.rb', line 10

def get_post(id, args = {})
  args = API.params(args)
            .optional(:version)
  response = get("/posts/#{id}.json", args)
  response[:body]
end

#wikify_post(id) ⇒ Object



17
18
19
# File 'lib/discourse_api/api/posts.rb', line 17

def wikify_post(id)
  put("/posts/#{id}/wiki", wiki: true)
end