Sha256: cccc7eaaefb03bfb21a590b93c18e1e9dd8198b675868cf683976df8efd03995

Contents?: true

Size: 699 Bytes

Versions: 43

Compression:

Stored size: 699 Bytes

Contents

module DiscourseApi
  module API
    module ApiKey
      def api
        response = get("/admin/api.json")
        response.body
      end

      def generate_user_api_key(user_id)
        response = post("/admin/users/#{user_id}/generate_api_key.json")
      end

      def revoke_user_api_key(user_id)
        response = delete("/admin/users/#{user_id}/revoke_api_key.json")
      end

      def generate_master_key
        response = post("/admin/api/key")
      end

      def revoke_api_key(id)
        response = delete("/admin/api/key", {id: id})
      end

      def regenerate_api_key(id)
        response = put("/admin/api/key", {id: id})
        response.body
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
discourse_api-0.4.3 lib/discourse_api/api/api_key.rb
discourse_api-0.4.2 lib/discourse_api/api/api_key.rb
discourse_api-0.4.1 lib/discourse_api/api/api_key.rb