lib/access/request.rb in access-2.0.37 vs lib/access/request.rb in access-2.0.38
- old
+ new
@@ -8,15 +8,16 @@
@url = set_base(path, api_type, options.delete(:api_environment))
@headers = set_headers options.delete(:access_token)
@timeout = options.delete(:access_timeout) || Access.config.access_timeout
@return_json = should_return_json?(options.delete(:return_json))
@use_hasify = hashify_results?(options.delete(:hashify))
+ @debug_output = options.delete(:access_debug_output) || Access.config.access_debug_output
end
def get(path, api_type, options={}, &block)
base_setup(path, api_type, options)
- results = self.class.get(url, headers: headers, query: options, timeout: timeout)
+ results = self.class.get(url, headers: headers, query: options, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
if return_json
use_hasify ? results.hashify : results
else
block.call results
end
@@ -26,11 +27,11 @@
raise Access::Error::NoData
end
def put(path, api_type, options={}, &block)
base_setup(path, api_type, options)
- results = self.class.put(url, headers: headers, body: options.to_json, timeout: timeout)
+ results = self.class.put(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
if return_json
use_hasify ? results.hashify : results
else
block.call results
end
@@ -40,11 +41,11 @@
raise Access::Error::NoData
end
def post(path, api_type, options={}, &block)
base_setup(path, api_type, options)
- results = self.class.post(url, headers: headers, body: options.to_json, timeout: timeout)
+ results = self.class.post(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
if return_json
use_hasify ? results.hashify : results
else
block.call results
end
@@ -54,11 +55,11 @@
raise Access::Error::NoData
end
def delete(path, api_type, options={}, &block)
base_setup(path, api_type, options)
- results = self.class.delete(url, headers: headers, body: options.to_json, timeout: timeout)
+ results = self.class.delete(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
if return_json
use_hasify ? results.hashify : results
else
block.call results
end
@@ -68,10 +69,10 @@
raise Access::Error::NoData
end
def post_for_filter(path, api_type, filter, options={}, &block)
base_setup(path, api_type, options)
- results = self.class.post(url, headers: headers, body: filter, timeout: timeout)
+ results = self.class.post(url, headers: headers, body: filter, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
if return_json
use_hasify ? results.hashify : results
else
block.call results
end