Module: Docuseal::HTTP

Included in:
Client
Defined in:
lib/docuseal/http.rb

Instance Method Summary collapse

Instance Method Details

#delete(path, headers: {}, **query) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/docuseal/http.rb', line 29

def delete(path, headers: {}, **query)
  full_uri = uri(path:, query:)

  conn.delete(full_uri) do |req|
    req.headers = all_headers(headers)
  end
end

#get(path, headers: {}, **query) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/docuseal/http.rb', line 3

def get(path, headers: {}, **query)
  full_uri = uri(path:, query:)

  conn.get(full_uri) do |req|
    req.headers = all_headers(headers)
  end
end

#post(path, data: {}, headers: {}, **query) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/docuseal/http.rb', line 11

def post(path, data: {}, headers: {}, **query)
  full_uri = uri(path:, query:)

  conn.post(full_uri) do |req|
    req.body = data.to_json if data.any?
    req.headers = all_headers(headers)
  end
end

#put(path, data: {}, headers: {}, **query) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/docuseal/http.rb', line 20

def put(path, data: {}, headers: {}, **query)
  full_uri = uri(path:, query:)

  conn.put(full_uri) do |req|
    req.body = data.to_json if data.any?
    req.headers = all_headers(headers)
  end
end