Class: OpenaiAssistant::HTTPClient
- Inherits:
-
Object
- Object
- OpenaiAssistant::HTTPClient
- Defined in:
- lib/openai_assistant/clients/http/http.rb
Overview
An http client
Instance Method Summary collapse
- #call_delete(url, headers, disable_ssl: false) ⇒ Object
- #call_get(url, headers, disable_ssl: false) ⇒ Object
-
#call_post(url, req_body, headers, disable_ssl: false) ⇒ Object
disable_ssl instead of ssl because almost the host is https.
Instance Method Details
#call_delete(url, headers, disable_ssl: false) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/openai_assistant/clients/http/http.rb', line 15 def call_delete(url, headers, disable_ssl: false) http = Net::HTTP.new(url.host, url.port) http.use_ssl = disable_ssl ? false : true request = Net::HTTP::Delete.new(url.path, headers) http.request(request) end |
#call_get(url, headers, disable_ssl: false) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/openai_assistant/clients/http/http.rb', line 22 def call_get(url, headers, disable_ssl: false) http = Net::HTTP.new(url.host, url.port) http.use_ssl = disable_ssl ? false : true request = Net::HTTP::Get.new(url.path, headers) http.request(request) end |
#call_post(url, req_body, headers, disable_ssl: false) ⇒ Object
disable_ssl instead of ssl because almost the host is https
7 8 9 10 11 12 13 |
# File 'lib/openai_assistant/clients/http/http.rb', line 7 def call_post(url, req_body, headers, disable_ssl: false) http = Net::HTTP.new(url.host, url.port) http.use_ssl = disable_ssl ? false : true request = Net::HTTP::Post.new(url.path, headers) request.body = req_body unless req_body.nil? http.request(request) end |