Module: GigaChat::HTTP
Instance Method Summary collapse
- #delete(path:) ⇒ Object
- #get(path:, parameters: nil) ⇒ Object
- #json_post(path:, parameters:) ⇒ Object
- #multipart_post(path:, parameters: nil) ⇒ Object
- #post(path:) ⇒ Object
Methods included from HTTPHeaders
Instance Method Details
#delete(path:) ⇒ Object
34 35 36 37 38 |
# File 'lib/gigachat/http.rb', line 34 def delete(path:) conn.delete(uri(path: path)) do |req| req.headers = headers end&.body end |
#get(path:, parameters: nil) ⇒ Object
9 10 11 12 13 |
# File 'lib/gigachat/http.rb', line 9 def get(path:, parameters: nil) parse_jsonl(conn.get(uri(path: path), parameters) do |req| req.headers = headers end&.body) end |
#json_post(path:, parameters:) ⇒ Object
21 22 23 24 25 |
# File 'lib/gigachat/http.rb', line 21 def json_post(path:, parameters:) conn.post(uri(path: path)) do |req| configure_json_post_request(req, parameters) end&.body end |
#multipart_post(path:, parameters: nil) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/gigachat/http.rb', line 27 def multipart_post(path:, parameters: nil) conn(multipart: true).post(uri(path: path)) do |req| req.headers = headers.merge({ "Content-Type" => "multipart/form-data" }) req.body = multipart_parameters(parameters) end&.body end |
#post(path:) ⇒ Object
15 16 17 18 19 |
# File 'lib/gigachat/http.rb', line 15 def post(path:) parse_jsonl(conn.post(uri(path: path)) do |req| req.headers = headers end&.body) end |