Module: ApiBase::Behaviours::Shared
Overview
Shared module that adds common methods to api behaviours
Instance Method Summary collapse
Instance Method Details
#behaviour_delegate(endpoint, payload = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/api_base/behaviours/shared.rb', line 7 def behaviour_delegate(endpoint, payload = {}) api_log = ApiBase::ApiLog.start_outgoing_request(self, method, endpoint, payload) response, duration = make_request(endpoint, payload) api_log.complete_outgoing_request response, duration response rescue StandardError => e api_log.exception = e if api_log.present? raise ensure if api_log.present? api_log.filter_sensitive_data { |data| filter_object(data) } api_log.save! end validate_status_code response if response.present? end |