Class: Vindi::Client
- Inherits:
-
Object
- Object
- Vindi::Client
- Defined in:
- lib/vindi/client.rb
Class Method Summary collapse
Class Method Details
.request(method, path, params = {}, headers = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/vindi/client.rb', line 8 def request(method, path, params = {}, headers = {}) api_key = Vindi.configuration.api_key raise UnauthorizedError.new("API key is not configured.", status: 401) unless api_key url = build_url(path) payload = build_payload(method, params) req_headers = build_headers(api_key, headers) execute_request(method, url, payload, req_headers) rescue RestClient::Exception => e handle_rest_client_error(e) end |