Class: Apiwork::Introspection::Action::Response
- Inherits:
-
Object
- Object
- Apiwork::Introspection::Action::Response
- Defined in:
- lib/apiwork/introspection/action/response.rb
Overview
Wraps action response definitions.
Instance Method Summary collapse
-
#body ⇒ Param?
The body for this response.
-
#body? ⇒ Boolean
Whether this response has a body.
-
#description ⇒ String?
The description for this response.
-
#initialize(dump) ⇒ Response
constructor
A new instance of Response.
-
#no_content? ⇒ Boolean
Whether this response has no content.
-
#to_h ⇒ Hash
Converts this response to a hash.
Constructor Details
#initialize(dump) ⇒ Response
Returns a new instance of Response.
19 20 21 |
# File 'lib/apiwork/introspection/action/response.rb', line 19 def initialize(dump) @dump = dump end |
Instance Method Details
#body ⇒ Param?
The body for this response.
27 28 29 |
# File 'lib/apiwork/introspection/action/response.rb', line 27 def body @body ||= @dump[:body] ? Param.build(@dump[:body]) : nil end |
#body? ⇒ Boolean
Whether this response has a body.
51 52 53 |
# File 'lib/apiwork/introspection/action/response.rb', line 51 def body? body.present? end |
#description ⇒ String?
The description for this response.
35 36 37 |
# File 'lib/apiwork/introspection/action/response.rb', line 35 def description @dump[:description] end |
#no_content? ⇒ Boolean
Whether this response has no content.
43 44 45 |
# File 'lib/apiwork/introspection/action/response.rb', line 43 def no_content? @dump[:no_content] end |
#to_h ⇒ Hash
Converts this response to a hash.
59 60 61 |
# File 'lib/apiwork/introspection/action/response.rb', line 59 def to_h { description:, body: body&.to_h, no_content: no_content? } end |