Class: Apicraft::Openapi::Operation
- Inherits:
-
Object
- Object
- Apicraft::Openapi::Operation
- Defined in:
- lib/apicraft/openapi/operation.rb
Overview
Represents an OpenAPI operation. like GET /pets
Instance Attribute Summary collapse
-
#operation ⇒ Object
Returns the value of attribute operation.
Instance Method Summary collapse
-
#initialize(operation) ⇒ Operation
constructor
A new instance of Operation.
- #raw_schema ⇒ Object
- #response_for(code) ⇒ Object
- #responses ⇒ Object
- #summary ⇒ Object
- #validate_request_body(content_type, body) ⇒ Object
Constructor Details
#initialize(operation) ⇒ Operation
Returns a new instance of Operation.
10 11 12 13 |
# File 'lib/apicraft/openapi/operation.rb', line 10 def initialize(operation) @operation = operation @operation_object = operation.operation_object end |
Instance Attribute Details
#operation ⇒ Object
Returns the value of attribute operation.
8 9 10 |
# File 'lib/apicraft/openapi/operation.rb', line 8 def operation @operation end |
Instance Method Details
#raw_schema ⇒ Object
32 33 34 |
# File 'lib/apicraft/openapi/operation.rb', line 32 def raw_schema @operation_object.raw_schema end |
#response_for(code) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/apicraft/openapi/operation.rb', line 23 def response_for(code) response = responses.response[code.to_s] return unless response.present? Response.new( response ) end |
#responses ⇒ Object
15 16 17 |
# File 'lib/apicraft/openapi/operation.rb', line 15 def responses @operation_object.responses end |
#summary ⇒ Object
19 20 21 |
# File 'lib/apicraft/openapi/operation.rb', line 19 def summary @operation_object.summary end |
#validate_request_body(content_type, body) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/apicraft/openapi/operation.rb', line 36 def validate_request_body(content_type, body) operation.validate_request_body( content_type, body ) end |