Class: Rubygpt::Response::BaseResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygpt/response.rb

Overview

Base class for all API response objects

Direct Known Subclasses

ChatCompletion

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_response) ⇒ BaseResponse

Returns a new instance of BaseResponse.

Parameters:

  • api_response (StandardApiResponse)

    The response from the API, standardized by the connection object

Raises:



37
38
39
40
41
42
# File 'lib/rubygpt/response.rb', line 37

def initialize(api_response)
  raise ConnectionReturnNotStandardizedError unless api_response.is_a?(StandardApiResponse)

  @api_response = api_response
  build_attributes_from_body
end

Instance Attribute Details

#api_responseObject (readonly)

The response from the API, standardized by the connection object



34
35
36
# File 'lib/rubygpt/response.rb', line 34

def api_response
  @api_response
end