From e71aac715bad2e1bec53db61a8663c0cb01a8075 Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Tue, 8 Jan 2019 17:20:13 -0500 Subject: [PATCH] Move common parameter information to RootApiDoc --- documentation/api/v1/event_api_doc.rb | 17 ++++++----------- documentation/api/v1/root_api_doc.rb | 9 +++++++++ documentation/api/v1/session_event_api_doc.rb | 16 ++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/documentation/api/v1/event_api_doc.rb b/documentation/api/v1/event_api_doc.rb index a8745e5b15..24d9a648ab 100644 --- a/documentation/api/v1/event_api_doc.rb +++ b/documentation/api/v1/event_api_doc.rb @@ -12,11 +12,6 @@ module EventApiDoc INFO_DESC = 'Information about the event specific to the event name.' INFO_EXAMPLE = {command: 'irb'} - ORDER_ENUM = [ - 'asc', - 'desc' - ] - # Swagger documentation for Event model swagger_schema :Event do key :required, [:name] @@ -42,8 +37,8 @@ module EventApiDoc parameter do key :name, :limit key :in, :query - key :description, 'The maximum number of events that will be retrieved from the query. (Default: 100)' - key :example, 100 + key :description, RootApiDoc::LIMIT_DESC + key :example, RootApiDoc::LIMIT_DEFAULT key :type, :integer key :format, :int32 key :required, false @@ -52,8 +47,8 @@ module EventApiDoc parameter do key :name, :offset key :in, :query - key :description, 'The number of events the query will begin reading from the start of the set. (Default: 0)' - key :example, 0 + key :description, RootApiDoc::OFFSET_DESC + key :example, RootApiDoc::OFFSET_DEFAULT key :type, :integer key :format, :int32 key :required, false @@ -62,10 +57,10 @@ module EventApiDoc parameter do key :name, :order key :in, :query - key :description, 'The event created_at sort order. (Default: desc)' + key :description, RootApiDoc::ORDER_DESC key :type, :string key :required, false - key :enum, ORDER_ENUM + key :enum, RootApiDoc::ORDER_ENUM end response 200 do diff --git a/documentation/api/v1/root_api_doc.rb b/documentation/api/v1/root_api_doc.rb index 48b3c858e2..46c3ef3391 100644 --- a/documentation/api/v1/root_api_doc.rb +++ b/documentation/api/v1/root_api_doc.rb @@ -17,6 +17,15 @@ module RootApiDoc AUTH_CODE_DESC = 'The authentication error code that was generated.' AUTH_CODE_EXAMPLE = 401 AUTH_MESSAGE_DESC = 'A message describing the authentication error that occurred.' + LIMIT_DEFAULT = 100 + LIMIT_DESC = "The maximum number of results that will be retrieved from the query. (Default: #{LIMIT_DEFAULT})" + OFFSET_DEFAULT = 0 + OFFSET_DESC = "The number of results the query will begin reading from the beginning of the set. (Default: #{OFFSET_DEFAULT})" + ORDER_DESC = 'The order in which results are returned, based on the created_at datetime. (Default: desc)' + ORDER_ENUM = [ + 'asc', + 'desc' + ] DEFAULT_RESPONSE_200 = 'Successful operation.' DEFAULT_RESPONSE_401 = 'Authenticate to access this resource.' diff --git a/documentation/api/v1/session_event_api_doc.rb b/documentation/api/v1/session_event_api_doc.rb index 100d94143e..2d2eacb99f 100644 --- a/documentation/api/v1/session_event_api_doc.rb +++ b/documentation/api/v1/session_event_api_doc.rb @@ -12,10 +12,6 @@ module SessionEventApiDoc LOCAL_PATH_EXAMPLE = '/path/to/file' REMOTE_PATH_DESC = 'Path to the associated file for upload, download, and filedelete events.' REMOTE_PATH_EXAMPLE = '/path/to/file' - ORDER_ENUM = [ - 'asc', - 'desc' - ] # Swagger documentation for session events model swagger_schema :SessionEvent do @@ -39,8 +35,8 @@ module SessionEventApiDoc parameter do key :name, :limit key :in, :query - key :description, 'The maximum number of session events that will be retrieved from the query. (Default: 100)' - key :example, 100 + key :description, RootApiDoc::LIMIT_DESC + key :example, RootApiDoc::LIMIT_DEFAULT key :type, :integer key :format, :int32 key :required, false @@ -49,8 +45,8 @@ module SessionEventApiDoc parameter do key :name, :offset key :in, :query - key :description, 'The number of session events the query will begin reading from the start of the set. (Default: 0)' - key :example, 0 + key :description, RootApiDoc::OFFSET_DESC + key :example, RootApiDoc::OFFSET_DEFAULT key :type, :integer key :format, :int32 key :required, false @@ -59,10 +55,10 @@ module SessionEventApiDoc parameter do key :name, :order key :in, :query - key :description, 'The session event created_at sort order. (Default: desc)' + key :description, RootApiDoc::ORDER_DESC key :type, :string key :required, false - key :enum, ORDER_ENUM + key :enum, RootApiDoc::ORDER_ENUM end response 200 do