Sha256: d3fd0d65dfe083a290299caae770d8c68104ead7a063b3b7a16cbeb655a0ecb3
Contents?: true
Size: 1.27 KB
Versions: 3
Compression:
Stored size: 1.27 KB
Contents
module DiscourseApi module API module Topics # :category OPTIONAL name of category, not ID # :skip_validations OPTIONAL boolean # :auto_track OPTIONAL boolean def create_topic(args) args = API.params(args) .required(:title, :raw) .optional(:skip_validations, :category, :auto_track) post("/posts", args.to_h) end def latest_topics(*args) response = get('/latest.json', args) response[:body]['topic_list']['topics'] end def new_topics(*args) response = get("/new.json", args) response[:body]['topic_list']['topics'] end def rename_topic(topic_id, title) put("/t/#{topic_id}.json", { topic_id: topic_id, title: title }) end def recategorize_topic(topic_id, category_id) put("/t/#{topic_id}.json", { topic_id: topic_id, category_id: category_id }) end def topic(id, *args) response = get("/t/#{id}.json", args) response[:body] end def topics_by(username, *args) response = get("/topics/created-by/#{username}.json", args) response[:body]['topic_list']['topics'] end def delete_topic(id) delete("/t/#{id}.json") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-0.3.0 | lib/discourse_api/api/topics.rb |
discourse_api-0.2.9 | lib/discourse_api/api/topics.rb |
discourse_api-0.2.8 | lib/discourse_api/api/topics.rb |