From 9e4bef9a0b336c2a2e04ba5d9223c2174806638e Mon Sep 17 00:00:00 2001 From: Brian Underwood Date: Mon, 13 Mar 2017 22:12:50 -0400 Subject: [PATCH] config_* to *_config to go from verb to noun. Also take advantage of fetch --- lib/neo4j/core/cypher_session/adaptors/http.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/neo4j/core/cypher_session/adaptors/http.rb b/lib/neo4j/core/cypher_session/adaptors/http.rb index 20779d85..1c9d61a8 100644 --- a/lib/neo4j/core/cypher_session/adaptors/http.rb +++ b/lib/neo4j/core/cypher_session/adaptors/http.rb @@ -148,7 +148,7 @@ def faraday_connection(options = {}) require 'faraday_middleware/multi_json' Faraday.new(url, options) do |c| - c.request :basic_auth, config_username(user, options), config_password(password, options) + c.request :basic_auth, username_config(options), password_config(options) c.request :multi_json c.response :multi_json, symbolize_keys: true, content_type: 'application/json' @@ -161,12 +161,12 @@ def faraday_connection(options = {}) end end - def config_password(password, options) - options[:basic_auth] ? options[:basic_auth][:password] : password + def password_config(options) + options.fetch(:basic_auth, {}).fetch(:password, @password) end - def config_username(user, options) - options[:basic_auth] ? options[:basic_auth][:username] : user + def username_config(options) + options.fetch(:basic_auth, {}).fetch(:username, @user) end def request_body(body)