neo4j-ruby-driver 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc91e8465e99e443737f4ddd76e2547b260582054d182334c01972158f23d501
4
- data.tar.gz: aa0f5b6b9d36235d727a6510d08f77844c099bd227338cea35d754d3b6366c3f
3
+ metadata.gz: 8d65c2ee6760cec8fc521979b62cda83acc9ffe0ff2c5f0d190b9afcf6923aa7
4
+ data.tar.gz: 54199c67bc880e059ad3280956b7b628969e91a4e7fd43838ad23c9bf5334c34
5
5
  SHA512:
6
- metadata.gz: 1420812891d8ae6d83c03804586ba854a6da5dba16680f10801c8469504cd4b40f184b0e81cedeb18252203fb571d826a2afd285e2e3ef09fe6009f3b54d252d
7
- data.tar.gz: 38b912cf6b5b33a347a66c4e6a21a5d01e3c4f6ba287bfdb04f78af9ad4ff3720da2811296deffaa56e5c35331dfb245cbe6841034d3faea0b1f50d395927b7a
6
+ metadata.gz: eecc477146f649aabf6ef8aae6a3c52391f2afba6ab37b495446b5cb5c0e2cd503247327e99e7e03ed4f624f5dca857bc0caf71cdd042a108ef426c412695e7d
7
+ data.tar.gz: 39489c64659ef01d68b8d9920a366a9a46031e40a7aa65cb385b91a315ece2c949a7aa2cb0fcf10e12e90bc9dbca5f106a0bf0c140eb9cdac937faba8076d48d
@@ -4,23 +4,46 @@ module Neo4j
4
4
  module Driver
5
5
  module Internal
6
6
  class DriverFactory
7
+ BOLT_URI_SCHEME = 'bolt'
8
+ BOLT_ROUTING_URI_SCHEME = 'bolt+routing'
9
+ NEO4J_URI_SCHEME = 'neo4j'
10
+ DEFAULT_PORT = 7687
11
+
7
12
  def new_instance(uri, auth_token, routing_settings, retry_settings, config)
13
+ uri = URI(uri)
8
14
  connector = create_connector(uri, auth_token)
9
- create_driver(uri, connector).tap(&:verify_connectivity)
15
+ create_driver(uri.scheme, connector, routing_settings).tap(&:verify_connectivity)
10
16
  end
11
17
 
12
18
  private
13
19
 
14
20
  def create_connector(uri, auth_token)
15
- uri = URI(uri)
16
- address = Bolt::Address.create(uri.host, uri.port.to_s)
21
+ address = Bolt::Address.create(host(uri).gsub(/^\[(.*)\]$/, '\\1'), port(uri).to_s)
17
22
  config = Bolt::Config.create
18
23
  Bolt::Config.set_user_agent(config, 'seabolt-cmake/1.7')
19
24
  Bolt::Connector.create(address, auth_token, config)
20
25
  end
21
26
 
22
- def create_driver(uri, connector)
23
- create_direct_driver(connector)
27
+ def host(uri)
28
+ uri.host.tap { |host| raise ArgumentError, "Invalid address format `#{uri}`" unless host }
29
+ end
30
+
31
+ def port(uri)
32
+ uri.port&.tap {|port| raise ArgumentError, "Illegal port: #{port}" unless (0..65_535).cover?(port) } ||
33
+ DEFAULT_PORT
34
+ end
35
+
36
+ def create_driver(scheme, connector, routing_settings)
37
+ case scheme
38
+ when BOLT_URI_SCHEME
39
+ # assert_no_routing_context( uri, routing_settings )
40
+ # return createDirectDriver( securityPlan, address, connectionPool, retryLogic, metrics, config );
41
+ create_direct_driver(connector)
42
+ when BOLT_ROUTING_URI_SCHEME, NEO4J_URI_SCHEME
43
+ # create_routing_driver( security_plan, address, connection_ool, eventExecutorGroup, routingSettings, retryLogic, metrics, config );
44
+ else
45
+ raise Exceptions::ClientException, "Unsupported URI scheme: #{scheme}"
46
+ end
24
47
  end
25
48
 
26
49
  def create_direct_driver(connector)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '0.1.7'
5
+ VERSION = '0.1.8'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-ruby-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-09 00:00:00.000000000 Z
11
+ date: 2019-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "<"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '13'
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "<"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '13'
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec-its
169
169
  requirement: !ruby/object:Gem::Requirement