Class: OpenapiFirst::Definition
- Inherits:
-
Object
- Object
- OpenapiFirst::Definition
- Defined in:
- lib/openapi_first/definition.rb
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
-
#operations ⇒ Object
readonly
Returns the value of attribute operations.
Instance Method Summary collapse
-
#initialize(resolved, filepath) ⇒ Definition
constructor
A new instance of Definition.
Constructor Details
#initialize(resolved, filepath) ⇒ Definition
Returns a new instance of Definition.
9 10 11 12 13 14 15 16 17 |
# File 'lib/openapi_first/definition.rb', line 9 def initialize(resolved, filepath) @filepath = filepath methods = %w[get head post put patch delete trace options] @operations = resolved['paths'].flat_map do |path, path_item| path_item.slice(*methods).map do |request_method, _operation_object| Operation.new(path, request_method, path_item) end end end |
Instance Attribute Details
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
7 8 9 |
# File 'lib/openapi_first/definition.rb', line 7 def filepath @filepath end |
#operations ⇒ Object (readonly)
Returns the value of attribute operations.
7 8 9 |
# File 'lib/openapi_first/definition.rb', line 7 def operations @operations end |