Module: DiscourseApi::API::Topics

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

Instance Method Summary collapse

Instance Method Details

#create_topic(params = {}) ⇒ Object



4
5
6
# File 'lib/discourse_api/api/topics.rb', line 4

def create_topic(params={})
  post("/posts", params)
end

#latest_topics(*args) ⇒ Object



8
9
10
11
# File 'lib/discourse_api/api/topics.rb', line 8

def latest_topics(*args)
  response = get('/latest.json', args)
  response[:body]['topic_list']['topics']
end

#new_topics(*args) ⇒ Object



13
14
15
16
# File 'lib/discourse_api/api/topics.rb', line 13

def new_topics(*args)
  response = get("/new.json", args)
  response[:body]['topic_list']['topics']
end

#topic(id, *args) ⇒ Object



18
19
20
21
# File 'lib/discourse_api/api/topics.rb', line 18

def topic(id, *args)
  response = get("/t/#{id}.json", args)
  response[:body]
end

#topics_by(username, *args) ⇒ Object



23
24
25
26
# File 'lib/discourse_api/api/topics.rb', line 23

def topics_by(username, *args)
  response = get("/topics/created-by/#{username}.json", args)
  response[:body]['topic_list']['topics']
end