Class: SpecForge::Documentation::Document::Operation
- Inherits:
-
Object
- Object
- SpecForge::Documentation::Document::Operation
- Defined in:
- lib/spec_forge/documentation/document/operation.rb
Overview
Represents an API operation (endpoint + HTTP method)
An Operation contains all the information about a specific API endpoint with a specific HTTP method, including parameters, request bodies, and possible responses.
Instance Method Summary collapse
-
#initialize(id:, summary:, parameters:, requests:, responses:) ⇒ Operation
constructor
Creates a new operation with normalized sub-components.
Constructor Details
#initialize(id:, summary:, parameters:, requests:, responses:) ⇒ Operation
Creates a new operation with normalized sub-components
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/spec_forge/documentation/document/operation.rb', line 34 def initialize(id:, summary:, parameters:, requests:, responses:) parameters = parameters.each_pair.map do |name, value| [name, Parameter.new(name: name.to_s, **value)] end.to_h requests = requests.map { |r| RequestBody.new(**r) } responses = responses.map { |r| Response.new(**r) } super end |