Class: Generator::ResponseModel
- Inherits:
-
Object
- Object
- Generator::ResponseModel
- Defined in:
- lib/generator/builders/response_model.rb
Constant Summary collapse
- DEFAULT_PAYLOAD_KEY =
"payload"
Instance Attribute Summary collapse
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(operation) ⇒ ResponseModel
constructor
A new instance of ResponseModel.
Constructor Details
#initialize(operation) ⇒ ResponseModel
Returns a new instance of ResponseModel.
9 10 11 |
# File 'lib/generator/builders/response_model.rb', line 9 def initialize(operation) @operation = operation end |
Instance Attribute Details
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
7 8 9 |
# File 'lib/generator/builders/response_model.rb', line 7 def operation @operation end |
Instance Method Details
#build ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generator/builders/response_model.rb', line 13 def build success_response = find_success_response return default_response_model unless success_response && success_response["schema"] schema = success_response["schema"] if schema["$ref"] build_ref_response_model(schema["$ref"]) elsif schema["properties"] && schema["properties"]["payload"] handle_inline_payload_response(schema["properties"]["payload"]) else default_response_model end end |