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



29
30
31
32
33
# File 'lib/minds/rest_client.rb', line 29

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

#get(path:) ⇒ Object



7
8
9
# File 'lib/minds/rest_client.rb', line 7

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

#patch(path:, parameters:) ⇒ Object



17
18
19
20
21
# File 'lib/minds/rest_client.rb', line 17

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

#post(path:, parameters:) ⇒ Object



11
12
13
14
15
# File 'lib/minds/rest_client.rb', line 11

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

#put(path:, parameters:) ⇒ Object



23
24
25
26
27
# File 'lib/minds/rest_client.rb', line 23

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