Move common parameter information to RootApiDoc

GSoC/Meterpreter_Web_Console
Matthew Kienow 2019-01-08 17:20:13 -05:00
parent 48c3f1c92d
commit e71aac715b
No known key found for this signature in database
GPG Key ID: 40787F8B1EAC6E41
3 changed files with 21 additions and 21 deletions

View File

@ -12,11 +12,6 @@ module EventApiDoc
INFO_DESC = 'Information about the event specific to the event name.' INFO_DESC = 'Information about the event specific to the event name.'
INFO_EXAMPLE = {command: 'irb'} INFO_EXAMPLE = {command: 'irb'}
ORDER_ENUM = [
'asc',
'desc'
]
# Swagger documentation for Event model # Swagger documentation for Event model
swagger_schema :Event do swagger_schema :Event do
key :required, [:name] key :required, [:name]
@ -42,8 +37,8 @@ module EventApiDoc
parameter do parameter do
key :name, :limit key :name, :limit
key :in, :query key :in, :query
key :description, 'The maximum number of events that will be retrieved from the query. (Default: 100)' key :description, RootApiDoc::LIMIT_DESC
key :example, 100 key :example, RootApiDoc::LIMIT_DEFAULT
key :type, :integer key :type, :integer
key :format, :int32 key :format, :int32
key :required, false key :required, false
@ -52,8 +47,8 @@ module EventApiDoc
parameter do parameter do
key :name, :offset key :name, :offset
key :in, :query key :in, :query
key :description, 'The number of events the query will begin reading from the start of the set. (Default: 0)' key :description, RootApiDoc::OFFSET_DESC
key :example, 0 key :example, RootApiDoc::OFFSET_DEFAULT
key :type, :integer key :type, :integer
key :format, :int32 key :format, :int32
key :required, false key :required, false
@ -62,10 +57,10 @@ module EventApiDoc
parameter do parameter do
key :name, :order key :name, :order
key :in, :query key :in, :query
key :description, 'The event created_at sort order. (Default: desc)' key :description, RootApiDoc::ORDER_DESC
key :type, :string key :type, :string
key :required, false key :required, false
key :enum, ORDER_ENUM key :enum, RootApiDoc::ORDER_ENUM
end end
response 200 do response 200 do

View File

@ -17,6 +17,15 @@ module RootApiDoc
AUTH_CODE_DESC = 'The authentication error code that was generated.' AUTH_CODE_DESC = 'The authentication error code that was generated.'
AUTH_CODE_EXAMPLE = 401 AUTH_CODE_EXAMPLE = 401
AUTH_MESSAGE_DESC = 'A message describing the authentication error that occurred.' 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_200 = 'Successful operation.'
DEFAULT_RESPONSE_401 = 'Authenticate to access this resource.' DEFAULT_RESPONSE_401 = 'Authenticate to access this resource.'

View File

@ -12,10 +12,6 @@ module SessionEventApiDoc
LOCAL_PATH_EXAMPLE = '/path/to/file' LOCAL_PATH_EXAMPLE = '/path/to/file'
REMOTE_PATH_DESC = 'Path to the associated file for upload, download, and filedelete events.' REMOTE_PATH_DESC = 'Path to the associated file for upload, download, and filedelete events.'
REMOTE_PATH_EXAMPLE = '/path/to/file' REMOTE_PATH_EXAMPLE = '/path/to/file'
ORDER_ENUM = [
'asc',
'desc'
]
# Swagger documentation for session events model # Swagger documentation for session events model
swagger_schema :SessionEvent do swagger_schema :SessionEvent do
@ -39,8 +35,8 @@ module SessionEventApiDoc
parameter do parameter do
key :name, :limit key :name, :limit
key :in, :query key :in, :query
key :description, 'The maximum number of session events that will be retrieved from the query. (Default: 100)' key :description, RootApiDoc::LIMIT_DESC
key :example, 100 key :example, RootApiDoc::LIMIT_DEFAULT
key :type, :integer key :type, :integer
key :format, :int32 key :format, :int32
key :required, false key :required, false
@ -49,8 +45,8 @@ module SessionEventApiDoc
parameter do parameter do
key :name, :offset key :name, :offset
key :in, :query key :in, :query
key :description, 'The number of session events the query will begin reading from the start of the set. (Default: 0)' key :description, RootApiDoc::OFFSET_DESC
key :example, 0 key :example, RootApiDoc::OFFSET_DEFAULT
key :type, :integer key :type, :integer
key :format, :int32 key :format, :int32
key :required, false key :required, false
@ -59,10 +55,10 @@ module SessionEventApiDoc
parameter do parameter do
key :name, :order key :name, :order
key :in, :query key :in, :query
key :description, 'The session event created_at sort order. (Default: desc)' key :description, RootApiDoc::ORDER_DESC
key :type, :string key :type, :string
key :required, false key :required, false
key :enum, ORDER_ENUM key :enum, RootApiDoc::ORDER_ENUM
end end
response 200 do response 200 do