Class: OpenapiFirst::Definition::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_first/definition/response.rb

Overview

Represents a response definition in the OpenAPI document. This is not a direct reflecton of the OpenAPI 3.X response definition, but a combination of status, content type and content schema.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation:, status:, response_object:, content_type:, content_schema:) ⇒ Response

Returns a new instance of Response.



9
10
11
12
13
14
15
# File 'lib/openapi_first/definition/response.rb', line 9

def initialize(operation:, status:, response_object:, content_type:, content_schema:)
  @operation = operation
  @response_object = response_object
  @status = status
  @content_type = content_type
  @content_schema = content_schema
end

Instance Attribute Details

#content_schemaObject (readonly)



21
22
23
# File 'lib/openapi_first/definition/response.rb', line 21

def content_schema
  @content_schema
end

#content_typeObject (readonly)



21
22
23
# File 'lib/openapi_first/definition/response.rb', line 21

def content_type
  @content_type
end

#operationObject (readonly)



21
22
23
# File 'lib/openapi_first/definition/response.rb', line 21

def operation
  @operation
end

#statusObject (readonly)



21
22
23
# File 'lib/openapi_first/definition/response.rb', line 21

def status
  @status
end

Instance Method Details

#descriptionObject



27
28
29
# File 'lib/openapi_first/definition/response.rb', line 27

def description
  @response_object['description']
end

#headersObject



23
24
25
# File 'lib/openapi_first/definition/response.rb', line 23

def headers
  @response_object['headers']
end