Module: DiscourseApi::API::Categories
- Included in:
- Client
- Defined in:
- lib/discourse_api/api/categories.rb
Instance Method Summary collapse
- #categories(*args) ⇒ Object
- #category_latest_topics(category_slug) ⇒ Object
-
#create_category(args) ⇒ Object
:color and :text_color are RGB hexadecimal strings.
Instance Method Details
#categories(*args) ⇒ Object
13 14 15 16 |
# File 'lib/discourse_api/api/categories.rb', line 13 def categories(*args) response = get('/categories.json', args) response[:body]['category_list']['categories'] end |
#category_latest_topics(category_slug) ⇒ Object
18 19 20 21 |
# File 'lib/discourse_api/api/categories.rb', line 18 def category_latest_topics(category_slug) response = get("/category/#{category_slug}/l/latest.json") response[:body]['topic_list']['topics'] end |
#create_category(args) ⇒ Object
:color and :text_color are RGB hexadecimal strings
5 6 7 8 9 10 11 |
# File 'lib/discourse_api/api/categories.rb', line 5 def create_category(args) post("/categories", API.params(args) .required(:name) .optional(:color, :text_color) .default(parent_category_id: nil) ) end |