Module: DiscourseApi::API::Groups
- Included in:
- Client
- Defined in:
- lib/discourse_api/api/groups.rb
Instance Method Summary collapse
- #create_group(args) ⇒ Object
- #group_add(group_id, *usernames) ⇒ Object
- #group_remove(group_id, *usernames) ⇒ Object
- #groups ⇒ Object
Instance Method Details
#create_group(args) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/discourse_api/api/groups.rb', line 4 def create_group(args) post("/admin/groups", group: API.params(args) .required(:name) .default(visible: true) .to_h ) end |
#group_add(group_id, *usernames) ⇒ Object
18 19 20 |
# File 'lib/discourse_api/api/groups.rb', line 18 def group_add(group_id, *usernames) patch("/admin/groups/#{group_id}", changes: {add: usernames}) end |
#group_remove(group_id, *usernames) ⇒ Object
22 23 24 |
# File 'lib/discourse_api/api/groups.rb', line 22 def group_remove(group_id, *usernames) patch("/admin/groups/#{group_id}", changes: {delete: usernames}) end |
#groups ⇒ Object
13 14 15 16 |
# File 'lib/discourse_api/api/groups.rb', line 13 def groups response = get("/admin/groups.json") response.body end |