Class: OpenapiFirst::ResponseParser
- Inherits:
-
Object
- Object
- OpenapiFirst::ResponseParser
- Defined in:
- lib/openapi_first/response_parser.rb
Overview
Parse a response
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
-
#initialize(headers:, content_type:) ⇒ ResponseParser
constructor
A new instance of ResponseParser.
- #parse(rack_response) ⇒ Object
Constructor Details
#initialize(headers:, content_type:) ⇒ ResponseParser
Returns a new instance of ResponseParser.
8 9 10 11 |
# File 'lib/openapi_first/response_parser.rb', line 8 def initialize(headers:, content_type:) @headers = headers @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
13 14 15 |
# File 'lib/openapi_first/response_parser.rb', line 13 def content_type @content_type end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
13 14 15 |
# File 'lib/openapi_first/response_parser.rb', line 13 def headers @headers end |
Instance Method Details
#parse(rack_response) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/openapi_first/response_parser.rb', line 15 def parse(rack_response) ParsedResponse.new( body: parse_body(rack_response), headers: parse_headers(rack_response) ) end |