Class: Praxis::Docs::OpenApi::ResponsesObject
- Inherits:
-
Object
- Object
- Praxis::Docs::OpenApi::ResponsesObject
- Defined in:
- lib/praxis/docs/open_api/responses_object.rb
Instance Attribute Summary collapse
- #responses ⇒ Object readonly
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(responses:) ⇒ ResponsesObject
constructor
A new instance of ResponsesObject.
Constructor Details
#initialize(responses:) ⇒ ResponsesObject
Returns a new instance of ResponsesObject.
12 13 14 |
# File 'lib/praxis/docs/open_api/responses_object.rb', line 12 def initialize(responses:) @responses = responses end |
Instance Attribute Details
#responses ⇒ Object (readonly)
10 11 12 |
# File 'lib/praxis/docs/open_api/responses_object.rb', line 10 def responses @responses end |
Instance Method Details
#dump ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/praxis/docs/open_api/responses_object.rb', line 16 def dump # { # "200": { # "description": "a pet to be returned", # "content": { # "application/json": { # "schema": { # type: :object # } # } # } # }, # "default": { # "description": "Unexpected error", # "content": { # "application/json": { # "schema": { # type: :object # } # } # } # } # } responses.each_with_object({}) do |(_response_name, response_definition), hash| hash[response_definition.status.to_s] = ResponseObject.new(info: response_definition).dump end end |