Class: Neo4j::Http::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/http/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = ENV) ⇒ Configuration

Returns a new instance of Configuration.



14
15
16
17
18
19
20
21
22
# File 'lib/neo4j/http/configuration.rb', line 14

def initialize(options = ENV)
  @uri = options.fetch("NEO4J_URL", "http://localhost:7474")
  @user = options.fetch("NEO4J_USER", "")
  @password = options.fetch("NEO4J_PASSWORD", "")
  @database_name = options.fetch("NEO4J_DATABASE", nil)
  @user_agent = options.fetch("NEO4J_HTTP_USER_AGENT", "Ruby Neo4j Http Client")
  @request_timeout_in_seconds = options.fetch("NEO4J_REQUEST_TIMEOUT_IN_SECONDS", nil)
  @access_mode = options.fetch("NEO4J_ACCESS_MODE", "WRITE")
end

Instance Attribute Details

#access_modeObject

Returns the value of attribute access_mode.



12
13
14
# File 'lib/neo4j/http/configuration.rb', line 12

def access_mode
  @access_mode
end

#database_nameObject

Returns the value of attribute database_name.



6
7
8
# File 'lib/neo4j/http/configuration.rb', line 6

def database_name
  @database_name
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/neo4j/http/configuration.rb', line 7

def password
  @password
end

#request_timeout_in_secondsObject

Returns the value of attribute request_timeout_in_seconds.



8
9
10
# File 'lib/neo4j/http/configuration.rb', line 8

def request_timeout_in_seconds
  @request_timeout_in_seconds
end

#uriObject

Returns the value of attribute uri.



9
10
11
# File 'lib/neo4j/http/configuration.rb', line 9

def uri
  @uri
end

#userObject

Returns the value of attribute user.



10
11
12
# File 'lib/neo4j/http/configuration.rb', line 10

def user
  @user
end

#user_agentObject

Returns the value of attribute user_agent.



11
12
13
# File 'lib/neo4j/http/configuration.rb', line 11

def user_agent
  @user_agent
end

Instance Method Details

#auth_tokenObject



36
37
38
# File 'lib/neo4j/http/configuration.rb', line 36

def auth_token
  Neo4j::Http::AuthToken.token(user, password)
end

#transaction_pathObject



26
27
28
29
30
31
32
33
34
# File 'lib/neo4j/http/configuration.rb', line 26

def transaction_path
  # v3.5 - /db/data/transaction/commit
  # v4.x - /db/#{database_name}/tx/commit
  if database_name
    "/db/#{database_name}/tx/commit"
  else
    "/db/data/transaction/commit"
  end
end