Module: Minds::RestClient

Included in:
Client
Defined in:
lib/minds/rest_client.rb

Instance Method Summary collapse

Instance Method Details

#delete(path:, parameters: nil) ⇒ Object



27
28
29
30
31
# File 'lib/minds/rest_client.rb', line 27

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

#get(path:) ⇒ Object



5
6
7
# File 'lib/minds/rest_client.rb', line 5

def get(path:)
  conn.get(uri(path: path))&.body
end

#patch(path:, parameters:) ⇒ Object



15
16
17
18
19
# File 'lib/minds/rest_client.rb', line 15

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

#post(path:, parameters:) ⇒ Object



9
10
11
12
13
# File 'lib/minds/rest_client.rb', line 9

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

#put(path:, parameters:) ⇒ Object



21
22
23
24
25
# File 'lib/minds/rest_client.rb', line 21

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