Sha256: e50e3534f35c4ff41f0fa801e8fdbf5bd2fa414b9b336563580f4ba898aaa7f9

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module DiscourseApi
  module API
    module Groups
      def create_group(args)
        args = API.params(args)
                  .required(:name)
                  .default(visible: true)
                  .to_h
        post("/admin/groups", group: args)
      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

1 entries across 1 versions & 1 rubygems

Version Path
discourse_api-0.4.0 lib/discourse_api/api/groups.rb