Module: DiscourseApi::API::Topics

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

Instance Method Summary collapse

Instance Method Details

#hot_topics(*args) ⇒ Object



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

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

#invite_user_to_topic(user_email, topic_id) ⇒ Object



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

def invite_user_to_topic(user_email, topic_id)
  params = { email: user_email, topic_id: topic_id }
  post "/t/#{topic_id}/invite.json", params
end

#latest_topics(*args) ⇒ Object



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

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

#new_topics(*args) ⇒ Object



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

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

#topic(id, *args) ⇒ Object



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

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

#topics_by(username, *args) ⇒ Object



29
30
31
32
# File 'lib/discourse_api/api/topics.rb', line 29

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