Class: OpenapiFirst::Router::RequestMatch

Inherits:
Data
  • Object
show all
Defined in:
lib/openapi_first/router.rb

Overview

Returned by #match

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



11
12
13
# File 'lib/openapi_first/router.rb', line 11

def error
  @error
end

#paramsObject (readonly)

Returns the value of attribute params

Returns:

  • (Object)

    the current value of params



11
12
13
# File 'lib/openapi_first/router.rb', line 11

def params
  @params
end

#request_definitionObject (readonly)

Returns the value of attribute request_definition

Returns:

  • (Object)

    the current value of request_definition



11
12
13
# File 'lib/openapi_first/router.rb', line 11

def request_definition
  @request_definition
end

#responsesObject (readonly)

Returns the value of attribute responses

Returns:

  • (Object)

    the current value of responses



11
12
13
# File 'lib/openapi_first/router.rb', line 11

def responses
  @responses
end

Instance Method Details

#match_response(status:, content_type:) ⇒ Object



12
13
14
15
# File 'lib/openapi_first/router.rb', line 12

def match_response(status:, content_type:)
  FindResponse.call(responses, status, content_type, request_method: request_definition.request_method,
                                                     path: request_definition.path)
end