class Apipie::Generator::Swagger::Warning
Constants
- ADDED_MISSING_SLASH_CODE
- CODES
- HASH_WITHOUT_INTERNAL_TYPESPEC_CODE
- MESSAGES
- MISSING_METHOD_SUMMARY_CODE
- NO_RETURN_CODES_SPECIFIED_CODE
- OPTIONAL_PARAM_IN_PATH_CODE
- OPTIONAL_WITHOUT_DEFAULT_VALUE_CODE
- PARAM_IGNORED_IN_FORM_DATA_CODE
- PATH_PARAM_NOT_DESCRIBED_CODE
Attributes
code[R]
Public Class Methods
for_code(code, method_id, message_attributes = {})
click to toggle source
@param [Integer] code @param [Hash] message_attributes
@return [Apipie::Generator::Swagger::Warning]
# File lib/apipie/generator/swagger/warning.rb, line 61 def self.for_code(code, method_id, message_attributes = {}) if !CODES.values.include?(code) raise ArgumentError, 'Unknown warning code' end info_message = if message_attributes.present? self::MESSAGES[code] % message_attributes else self::MESSAGES[code] end Apipie::Generator::Swagger::Warning.new(code, info_message, method_id) end
new(code, info_message, method_id)
click to toggle source
# File lib/apipie/generator/swagger/warning.rb, line 35 def initialize(code, info_message, method_id) @code = code @info_message = info_message @method_id = method_id end
Public Instance Methods
id()
click to toggle source
# File lib/apipie/generator/swagger/warning.rb, line 41 def id "#{@method_id}#{@code}#{@info_message}" end
warn()
click to toggle source
# File lib/apipie/generator/swagger/warning.rb, line 49 def warn Warning.warn(warning_message) end
warn_through_writer()
click to toggle source
# File lib/apipie/generator/swagger/warning.rb, line 53 def warn_through_writer Apipie::Generator::Swagger::WarningWriter.instance.warn(self) end
warning_message()
click to toggle source
# File lib/apipie/generator/swagger/warning.rb, line 45 def warning_message "WARNING (#{@code}): [#{@method_id}] -- #{@info_message}\n" end