Class: Rubygpt::Response::StandardApiResponse
- Inherits:
-
Object
- Object
- Rubygpt::Response::StandardApiResponse
- Defined in:
- lib/rubygpt/response.rb
Overview
Unifies responses from all connection/adapter objects.
This is required since a response from Faraday will not be the same as a response from another adapter
that might be introduced in the future. To solve this,
we're overriding the post, get, put, delete methods in connection objects to return a StandardApiResponse
Instance Attribute Summary collapse
-
#adapter_response ⇒ Object
readonly
The original, non-standardized response object received from the adapter This is useful for debugging and for accessing adapter-specific features.
-
#body ⇒ Object
readonly
The HTTP package contents of the response.
-
#headers ⇒ Object
readonly
The HTTP package contents of the response.
-
#status ⇒ Object
readonly
The HTTP package contents of the response.
Instance Method Summary collapse
-
#initialize(status:, body:, headers:, adapter_response: nil) ⇒ StandardApiResponse
constructor
A new instance of StandardApiResponse.
Constructor Details
#initialize(status:, body:, headers:, adapter_response: nil) ⇒ StandardApiResponse
Returns a new instance of StandardApiResponse.
23 24 25 26 27 28 |
# File 'lib/rubygpt/response.rb', line 23 def initialize(status:, body:, headers:, adapter_response: nil) @status = status @body = body @headers = headers @adapter_response = adapter_response end |
Instance Attribute Details
#adapter_response ⇒ Object (readonly)
The original, non-standardized response object received from the adapter This is useful for debugging and for accessing adapter-specific features
17 18 19 |
# File 'lib/rubygpt/response.rb', line 17 def adapter_response @adapter_response end |
#body ⇒ Object (readonly)
The HTTP package contents of the response
13 14 15 |
# File 'lib/rubygpt/response.rb', line 13 def body @body end |
#headers ⇒ Object (readonly)
The HTTP package contents of the response
13 14 15 |
# File 'lib/rubygpt/response.rb', line 13 def headers @headers end |
#status ⇒ Object (readonly)
The HTTP package contents of the response
13 14 15 |
# File 'lib/rubygpt/response.rb', line 13 def status @status end |