9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/vindi/client.rb', line 9
def request(method, path, params = {}, = {})
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)
= (api_key, )
if cacheable?(method, path)
fetch_from_cache(path, params) { execute_request_with_retry(method, url, payload, ) }
else
execute_request_with_retry(method, url, payload, )
end
rescue RestClient::Exception => e
handle_rest_client_error(e)
end
|