Skip to content

Commit

Permalink
config_* to *_config to go from verb to noun. Also take advantage of …
Browse files Browse the repository at this point in the history
…fetch
  • Loading branch information
cheerfulstoic committed Mar 14, 2017
1 parent 6903d37 commit 9e4bef9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/neo4j/core/cypher_session/adaptors/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand Down

0 comments on commit 9e4bef9

Please sign in to comment.