Sha256: 4ce03c7fd8b4a012739382bbd3471bc4bcd93baaee817c6bef7ad01957dc1d85

Contents?: true

Size: 641 Bytes

Versions: 1

Compression:

Stored size: 641 Bytes

Contents

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