From e74817cbb92f76291a7e938718478beb363b5f2b Mon Sep 17 00:00:00 2001 From: Blake Erickson Date: Thu, 9 Jul 2020 17:39:05 -0600 Subject: [PATCH] DEV: Document set notification level endpoint Another commit using rswag to document the api so that the api docs can be automatically generated. --- spec/requests/api/topics_spec.rb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/spec/requests/api/topics_spec.rb b/spec/requests/api/topics_spec.rb index 7ba79b5f6e2..f5c9f8d4eaa 100644 --- a/spec/requests/api/topics_spec.rb +++ b/spec/requests/api/topics_spec.rb @@ -852,4 +852,36 @@ describe 'posts' do end end + path '/t/{id}/notifications.json' do + post 'Set notification level' do + tags 'Topics' + 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: :id, in: :path, schema: { type: :string } + + parameter name: :request_body, in: :body, schema: { + type: :object, + properties: { + notification_level: { + type: :string, + enum: ['0', '1', '2', '3'], + } + }, required: [ 'notification_level' ] + } + + produces 'application/json' + response '200', 'topic updated' do + schema type: :object, properties: { + success: { type: :string }, + } + + let(:request_body) { { notification_level: '3' } } + let(:id) { Fabricate(:topic).id } + + run_test! + end + end + end + end