lib/finapps/rest/base_client.rb in finapps-2.0.16 vs lib/finapps/rest/base_client.rb in finapps-2.0.17

- old
+ new

@@ -36,11 +36,11 @@ # @return [Hash,Array<String>] def send_request(path, method, params={}) raise FinApps::MissingArgumentsError.new 'Missing argument: path.' if path.blank? raise FinApps::MissingArgumentsError.new 'Missing argument: method.' if method.blank? - response, error_messages = execute_request(method, params, path) + response, error_messages = execute_request(path, method, params) result = if empty?(response) nil else block_given? ? yield(response) : response.body end @@ -52,14 +52,14 @@ def empty?(response) response.blank? || (response.respond_to?(:body) && response.body.blank?) end - def execute_request(method, params, path) + def execute_request(path, method, params) error_messages = [] begin - response = execute_method method, params, path + response = execute_method path, method, params rescue FinApps::InvalidArgumentsError, FinApps::MissingArgumentsError, Faraday::Error::ConnectionFailed => error handle_error error rescue Faraday::Error::ClientError => error @@ -84,10 +84,10 @@ def handle_standard_error(error) logger.error "#{self.class}##{__method__} => StandardError, #{error}" ['Unexpected error.'] end - def execute_method(method, params, path) + def execute_method(path, method, params) case method when :get get(path) when :post post(path, params)