discourse/spec/requests/api/invites_spec.rb
Blake Erickson c9515ede2e
DEV: Add api docs for invite and group update endpoint (#11019)
Documenting a few more endpoints so that our api docs can be
automatically generated. Made a couple other minor changes, like
including the "OK" example for our default success response.
2020-10-26 08:55:22 -06:00

64 lines
1.8 KiB
Ruby

# frozen_string_literal: true
require 'swagger_helper'
describe 'invites' do
let(:'Api-Key') { Fabricate(:api_key).key }
let(:'Api-Username') { 'system' }
path '/invites.json' do
post 'Invite to site by email' do
tags 'Invites'
consumes 'application/json'
parameter name: 'Api-Key', in: :header, type: :string, required: true
parameter name: 'Api-Username', in: :header, type: :string, required: true
parameter name: :request_body, in: :body, schema: {
type: :object,
properties: {
email: { type: :string },
group_names: { type: :string },
custom_message: { type: :string },
}, required: ['email']
}
produces 'application/json'
response '200', 'success response' do
schema type: :object, properties: {
success: { type: :string, example: "OK" }
}
let(:request_body) { { email: 'not-a-user-yet@example.com' } }
run_test!
end
end
end
path '/invites/link.json' do
post 'Generate an invite link, but do not send an email' do
tags 'Invites'
consumes 'application/json'
parameter name: 'Api-Key', in: :header, type: :string, required: true
parameter name: 'Api-Username', in: :header, type: :string, required: true
parameter name: :request_body, in: :body, schema: {
type: :object,
properties: {
email: { type: :string },
group_names: { type: :string },
custom_message: { type: :string },
}, required: ['email']
}
produces 'application/json'
response '200', 'success response' do
schema type: :string, example: "http://discourse.example.com/invites/token_value"
let(:request_body) { { email: 'not-a-user-yet@example.com' } }
run_test!
end
end
end
end