Class: Neography::Connection
- Inherits:
-
Object
- Object
- Neography::Connection
- Defined in:
- lib/neography/connection.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#client ⇒ Object
Returns the value of attribute client.
-
#cypher_path ⇒ Object
Returns the value of attribute cypher_path.
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#gremlin_path ⇒ Object
Returns the value of attribute gremlin_path.
-
#log_enabled ⇒ Object
Returns the value of attribute log_enabled.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_threads ⇒ Object
Returns the value of attribute max_threads.
-
#parser ⇒ Object
Returns the value of attribute parser.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#server ⇒ Object
Returns the value of attribute server.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #authenticate(path) ⇒ Object
- #configuration ⇒ Object
- #configure(protocol, server, port, directory) ⇒ Object
-
#initialize(options = ENV['NEO4J_URL'] || {}) ⇒ Connection
constructor
A new instance of Connection.
- #merge_options(options) ⇒ Object
Constructor Details
#initialize(options = ENV['NEO4J_URL'] || {}) ⇒ Connection
Returns a new instance of Connection.
15 16 17 18 19 20 21 |
# File 'lib/neography/connection.rb', line 15 def initialize( = ENV['NEO4J_URL'] || {}) config = merge_configuration() save_local_configuration(config) @client = HTTPClient.new @client.send_timeout = 1200 # 10 minutes @client.receive_timeout = 1200 end |
Instance Attribute Details
#authentication ⇒ Object
Returns the value of attribute authentication.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def authentication @authentication end |
#client ⇒ Object
Returns the value of attribute client.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def client @client end |
#cypher_path ⇒ Object
Returns the value of attribute cypher_path.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def cypher_path @cypher_path end |
#directory ⇒ Object
Returns the value of attribute directory.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def directory @directory end |
#gremlin_path ⇒ Object
Returns the value of attribute gremlin_path.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def gremlin_path @gremlin_path end |
#log_enabled ⇒ Object
Returns the value of attribute log_enabled.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def log_enabled @log_enabled end |
#log_file ⇒ Object
Returns the value of attribute log_file.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def log_file @log_file end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def logger @logger end |
#max_threads ⇒ Object
Returns the value of attribute max_threads.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def max_threads @max_threads end |
#parser ⇒ Object
Returns the value of attribute parser.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def parser @parser end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def protocol @protocol end |
#server ⇒ Object
Returns the value of attribute server.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def server @server end |
#username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/neography/connection.rb', line 8 def username @username end |
Instance Method Details
#authenticate(path) ⇒ Object
48 49 50 51 52 |
# File 'lib/neography/connection.rb', line 48 def authenticate(path) @client.set_auth(path, @authentication[@authentication.keys.first][:username], @authentication[@authentication.keys.first][:password]) unless @authentication.empty? end |
#configuration ⇒ Object
30 31 32 |
# File 'lib/neography/connection.rb', line 30 def configuration @configuration ||= "#{@protocol}#{@server}:#{@port}#{@directory}/db/data" end |
#configure(protocol, server, port, directory) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/neography/connection.rb', line 23 def configure(protocol, server, port, directory) @protocol = protocol @server = server @port = port @directory = directory end |
#merge_options(options) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/neography/connection.rb', line 34 def () = .merge!(@authentication) [:headers].merge!(@user_agent) if [:headers] [:headers].merge!('X-Stream' => true) if [:headers] end |