Class: OpenAI::HTTPClient::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/http_client.rb,
sig/openai/http_client.rbs

Overview

An HTTP request prepared by the SDK.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method:, url:, headers:, body:, timeout:) ⇒ Request

Returns a new instance of Request.

Parameters:

  • method (Symbol)
  • url (URI::Generic)
  • headers (Hash{String=>String})
  • body (Object, nil)
  • timeout (Float, nil)


127
128
129
130
131
132
133
134
# File 'lib/openai/http_client.rb', line 127

def initialize(method:, url:, headers:, body:, timeout:)
  @method = method
  @url = url
  @headers = headers.dup.freeze
  @body = body
  @timeout = timeout
  freeze
end

Instance Attribute Details

#bodyObject? (readonly)

Returns:

  • (Object, nil)


117
118
119
# File 'lib/openai/http_client.rb', line 117

def body
  @body
end

#headersHash{String=>String} (readonly)

Returns:

  • (Hash{String=>String})


114
115
116
# File 'lib/openai/http_client.rb', line 114

def headers
  @headers
end

#methodSymbol (readonly)

Returns:

  • (Symbol)


108
109
110
# File 'lib/openai/http_client.rb', line 108

def method
  @method
end

#timeoutFloat? (readonly)

Returns:

  • (Float, nil)


120
121
122
# File 'lib/openai/http_client.rb', line 120

def timeout
  @timeout
end

#urlURI::Generic (readonly)

Returns:

  • (URI::Generic)


111
112
113
# File 'lib/openai/http_client.rb', line 111

def url
  @url
end