Sha256: 7ba922238424bdfe816cfa33a762f7f6e73872128f00b1ceadc959071aa8d64c

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

module DiscourseApi
  module API
    module Groups
      def create_group(args)

        post("/admin/groups", group: API.params(args)
                                         .required(:name)
                                         .default(visible: true)
                                         .to_h
        )
      end

      def groups
        response = get("/admin/groups.json")
        response.body
      end

      def group_add(group_id, *usernames)
        patch("/admin/groups/#{group_id}", changes: {add: usernames})
      end

      def group_remove(group_id, *usernames)
        patch("/admin/groups/#{group_id}", changes: {delete: usernames})
      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/groups.rb
discourse_api-0.2.9 lib/discourse_api/api/groups.rb
discourse_api-0.2.8 lib/discourse_api/api/groups.rb