Sha256: d131f0d2ac479d77d0b65872406b624f46bea3d7f8c283347a6bc26988c2c9da

Contents?: true

Size: 725 Bytes

Versions: 9

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true
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

9 entries across 9 versions & 1 rubygems

Version Path
discourse_api-0.40.0 lib/discourse_api/api/api_key.rb
discourse_api-0.39.3 lib/discourse_api/api/api_key.rb
discourse_api-0.39.2 lib/discourse_api/api/api_key.rb
discourse_api-0.39.1 lib/discourse_api/api/api_key.rb
discourse_api-0.39.0 lib/discourse_api/api/api_key.rb
discourse_api-0.38.0 lib/discourse_api/api/api_key.rb
discourse_api-0.37.0 lib/discourse_api/api/api_key.rb
discourse_api-0.36.0 lib/discourse_api/api/api_key.rb
discourse_api-0.35.0 lib/discourse_api/api/api_key.rb