Class: ONEAccess::Http::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/oneaccess/http/http_client.rb

Class Method Summary collapse

Class Method Details

.get(url, params = {}) ⇒ Object



7
8
9
10
11
# File 'lib/oneaccess/http/http_client.rb', line 7

def get(url, params = {})
  RestClient.get(url, { params: params }.merge(auth_headers))
rescue RestClient::Exception => e
  raise create_api_error(e)
end

.post(url, body, headers = {}) ⇒ Object



13
14
15
16
17
# File 'lib/oneaccess/http/http_client.rb', line 13

def post(url, body, headers = {})
  RestClient.post(url, body.to_json, headers.merge(auth_headers))
rescue RestClient::Exception => e
  raise create_api_error(e)
end