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)
  • method: (Symbol)
  • url: (URI::Generic)
  • headers: (::Hash[String, String])
  • body: (top)
  • timeout: (Float, nil)


166
167
168
169
170
171
172
173
# File 'lib/openai/http_client.rb', line 166

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

Instance Attribute Details

#body ⇒ Object? (readonly)

Returns:

  • (Object, nil)


156
157
158
# File 'lib/openai/http_client.rb', line 156

def body
  @body
end

#headers ⇒ Hash{String=>String} (readonly)

Returns:

  • (Hash{String=>String})


153
154
155
# File 'lib/openai/http_client.rb', line 153

def headers
  @headers
end

#method ⇒ Symbol (readonly)

Returns:

  • (Symbol)


147
148
149
# File 'lib/openai/http_client.rb', line 147

def method
  @method
end

#timeout ⇒ Float? (readonly)

Returns:

  • (Float, nil)


159
160
161
# File 'lib/openai/http_client.rb', line 159

def timeout
  @timeout
end

#url ⇒ URI::Generic (readonly)

Returns:

  • (URI::Generic)


150
151
152
# File 'lib/openai/http_client.rb', line 150

def url
  @url
end