lib/xhash/client/json_api.rb in xhash_client-0.3.5 vs lib/xhash/client/json_api.rb in xhash_client-0.3.6
- old
+ new
@@ -9,11 +9,11 @@
}
end
def api_get(url:, headers: {})
custom_headers = headers.merge(default_headers)
- response = HTTParty.get(Xhash.api_base + url, headers: custom_headers)
+ response = HTTParty.get(Xhash.api_base + url, headers: custom_headers, timeout: Xhash.timeout)
raise Xhash::Error.new(response) unless response_ok?(response)
begin
JSON.parse(response.body, symbolize_names: true)
@@ -26,11 +26,11 @@
custom_headers = headers.merge(default_headers)
response =
HTTParty.post(
Xhash.api_base + url,
- body: body.to_json, headers: custom_headers
+ body: body.to_json, headers: custom_headers, timeout: Xhash.timeout
)
raise Xhash::Error.new(response) unless response_ok?(response)
begin
@@ -44,10 +44,10 @@
custom_headers = headers.merge(default_headers)
response =
HTTParty.post(
Xhash.api_base + url,
- multipart: true, body: body, headers: custom_headers
+ multipart: true, body: body, headers: custom_headers, timeout: Xhash.timeout
)
raise Xhash::Error.new(response) unless response_ok?(response)
response.body
end