Class: OpenAPIParser::PathItemFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi_parser/path_item_finder.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ PathItemFinder

Returns a new instance of PathItemFinder.

Parameters:



3
4
5
# File 'lib/openapi_parser/path_item_finder.rb', line 3

def initialize(paths)
  @paths = paths
end

Instance Method Details

#operation_object(http_method, request_path) ⇒ Result?

find operation object and if not exist return nil

Parameters:

  • http_method (String, Symbol)

    like (get, post .… allow symbol)

  • request_path (String)

Returns:



11
12
13
14
15
16
17
18
19
20
# File 'lib/openapi_parser/path_item_finder.rb', line 11

def operation_object(http_method, request_path)
  if (path_item_object = @paths.path[request_path])
    if (op = path_item_object.operation(http_method))
      return Result.new(path_item_object, op, request_path, {}) # find no path_params path
    end
  end

  # check with path_params
  parse_request_path(http_method, request_path)
end