Module: AlephAlpha::HTTP

Included in:
Client
Defined in:
lib/aleph-alpha/http.rb

Instance Method Summary collapse

Instance Method Details

#delete(path:) ⇒ Object



23
24
25
26
27
# File 'lib/aleph-alpha/http.rb', line 23

def delete(path:)
  to_json(conn.delete(uri(path: path)) do |req|
    req.headers = headers
  end&.body)
end

#get(path:) ⇒ Object



3
4
5
6
7
# File 'lib/aleph-alpha/http.rb', line 3

def get(path:)
  to_json(conn.get(uri(path: path)) do |req|
    req.headers = headers
  end&.body)
end

#json_patch(path:, parameters:) ⇒ Object



16
17
18
19
20
21
# File 'lib/aleph-alpha/http.rb', line 16

def json_patch(path:, parameters:)
  to_json(conn.patch(uri(path: path)) do |req|
    req.headers = headers
    req.body = parameters.to_json
  end&.body)
end

#json_post(path:, parameters:) ⇒ Object



9
10
11
12
13
14
# File 'lib/aleph-alpha/http.rb', line 9

def json_post(path:, parameters:)
  to_json(conn.post(uri(path: path)) do |req|
    req.headers = headers
    req.body = parameters.to_json
  end&.body)
end