Class: CleoQualityReview::LlmProviders::OpenAi::HttpResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/cleo_quality_review/llm_providers/open_ai.rb

Overview

Value object representing an HTTP response from OpenAI.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyString (readonly)

Returns response body.

Returns:

  • (String)

    response body



22
23
24
25
26
27
28
29
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 22

HttpResponse = Struct.new(:status_code, :body, keyword_init: true) do
  ##
  # Check if the response indicates success.
  # @return [Boolean]
  def success?
    (200..299).cover?(status_code.to_i)
  end
end

#status_codeInteger (readonly)

Returns HTTP status code.

Returns:

  • (Integer)

    HTTP status code



22
23
24
25
26
27
28
29
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 22

HttpResponse = Struct.new(:status_code, :body, keyword_init: true) do
  ##
  # Check if the response indicates success.
  # @return [Boolean]
  def success?
    (200..299).cover?(status_code.to_i)
  end
end

Instance Method Details

#success?Boolean

Check if the response indicates success.

Returns:

  • (Boolean)


26
27
28
# File 'lib/cleo_quality_review/llm_providers/open_ai.rb', line 26

def success?
  (200..299).cover?(status_code.to_i)
end