neo4j-java-driver 4.1.0.beta.1-java → 4.2.0-java

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: 5631416868ef0ee4e31eee3ebe51534110c0dc8edf012121d0555662141fd79a
4
- data.tar.gz: 9d2703ce1ccb0ac139589582b26c274b5a4985cd01e160634e45b9a058600205
3
+ metadata.gz: cf45a8f27d9cf287ab09b59734afe619612f5d19922d15e244a03f1b21acb175
4
+ data.tar.gz: c68fe4e55bf2805f633ca453f4736979936ac47a9b8ebb3d0bc8f484729c7025
5
5
  SHA512:
6
- metadata.gz: b0003aa8a1bf14b9d7daca164c9cb1ce79fecb7d354495123a5bd3dc1f75c266707e8617c652f5df3b6294b4ce79415cce71c2d57e7cb099eef91d68ca32de64
7
- data.tar.gz: 166d16d61082ad1c8997c6f50c0d72c25ac23cbd1a495c1d175f0061e992fe44b75b96ef80788c3f7d1fc89221f52f3cc4cb04c0107550f9840ba29d4056d6e2
6
+ metadata.gz: ca113bd288db561f5ce921e358c10d99b4f5d6c4a98cca9e106a5f2f28af74aed0aebbdb36e189d695dc74b6773ad7aba7d40bd1cd07f999dc96873e5197c3a5
7
+ data.tar.gz: 9d6f276659e0ea199a6f940f1e7cab7b7a9083a2603ed02bfde75c58bf411d918a93f5400383fc4ebfbca185044280d75f7bc6d2a3e10d705f42d9adcaf2d1bf
@@ -4,7 +4,7 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module AuthTokens
7
- def basic(username, password)
7
+ def basic(username, password, realm = nil)
8
8
  Neo4j::Driver::Internal::Validator.require_non_nil_credentials!(username, password)
9
9
  super
10
10
  end
@@ -9,7 +9,7 @@ module Neo4j
9
9
  private
10
10
 
11
11
  def to_java_config(builder_class, **hash)
12
- hash.reduce(builder_class.builder) { |object, key_value| object.send(*config_method(*key_value)) }.build
12
+ hash.compact.reduce(builder_class.builder) { |object, key_value| object.send(*config_method(*key_value)) }.build
13
13
  end
14
14
 
15
15
  def config_method(key, value)
@@ -17,10 +17,8 @@ module Neo4j
17
17
  unit = nil
18
18
  case key.to_s
19
19
  when 'encryption'
20
- unless value
21
- method = :without_encryption
22
- value = nil
23
- end
20
+ method = :without_encryption unless value
21
+ value = nil
24
22
  when 'timeout'
25
23
  value = java.time.Duration.ofMillis(Driver::Internal::DurationNormalizer.milliseconds(value))
26
24
  when /time(out)?$/
@@ -20,8 +20,19 @@ module Neo4j
20
20
 
21
21
  def reverse_check
22
22
  yield
23
- rescue StandardError => e
24
- raise(e.cause || ExceptionMapper.reverse_exception_class(e)&.new('') || e)
23
+ rescue Neo4j::Driver::Exceptions::ServiceUnavailableException => e
24
+ raise(throwable(e.cause) || Java::OrgNeo4jDriverExceptions::ServiceUnavailableException.new(e.message))
25
+ rescue Neo4j::Driver::Exceptions::Neo4jException,
26
+ Neo4j::Driver::Exceptions::NoSuchRecordException,
27
+ Neo4j::Driver::Exceptions::UntrustedServerException,
28
+ Neo4j::Driver::Exceptions::IllegalStateException => e
29
+ raise(throwable(e.cause) || e)
30
+ end
31
+
32
+ private
33
+
34
+ def throwable(e)
35
+ e if e.is_a? Java::JavaLang::Throwable
25
36
  end
26
37
  end
27
38
  end
@@ -24,14 +24,7 @@ module Neo4j
24
24
  end
25
25
 
26
26
  def arguments
27
- [code, message, self, suppressed.map(&method(:mapped_exception))]
28
- end
29
-
30
- def self.reverse_exception_class(exception)
31
- case exception
32
- when Neo4j::Driver::Exceptions::ServiceUnavailableException
33
- ServiceUnavailableException
34
- end
27
+ [code, message, suppressed.map(&method(:mapped_exception))]
35
28
  end
36
29
 
37
30
  private
@@ -16,8 +16,6 @@ module Neo4j
16
16
  object.map(&method(:to_neo))
17
17
  when Types::Bytes
18
18
  object.to_java_bytes
19
- when Date
20
- Java::JavaTime::LocalDate.of(object.year, object.month, object.day)
21
19
  when ActiveSupport::Duration
22
20
  Java::OrgNeo4jDriverInternal::InternalIsoDuration.new(
23
21
  *Driver::Internal::DurationNormalizer.normalize(object)
@@ -34,8 +32,12 @@ module Neo4j
34
32
  object.nsec)
35
33
  when ActiveSupport::TimeWithZone
36
34
  to_zoned_date_time(object, object.time_zone.tzinfo.identifier)
37
- when Time
35
+ when Time, DateTime
38
36
  to_zoned_date_time(object, object.formatted_offset)
37
+ when Date
38
+ Java::JavaTime::LocalDate.of(object.year, object.month, object.day)
39
+ when Symbol
40
+ object.to_s
39
41
  when nil, true, false, Integer, Float, String
40
42
  object
41
43
  else
data/lib/loader.rb CHANGED
@@ -8,7 +8,7 @@ class Loader
8
8
  loader.tag = 'neo4j-ruby-driver'
9
9
  loader.push_dir(File.expand_path(__dir__))
10
10
  loader.push_dir(File.dirname(File.dirname(caller_locations(1..1).first.path)))
11
- loader.ignore(File.expand_path('neo4j-java-driver_jars.rb', __dir__))
11
+ loader.ignore(File.expand_path('neo4j-*-driver_jars.rb', __dir__))
12
12
  loader.ignore(File.expand_path('neo4j_ruby_driver.rb', __dir__))
13
13
  loader.ignore(File.expand_path('org', __dir__))
14
14
  loader.inflector = Zeitwerk::GemInflector.new(File.expand_path('neo4j/driver', __dir__))
@@ -4,12 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
6
  class Neo4jException < RuntimeError
7
- attr_reader :code, :cause, :suppressed
7
+ attr_reader :code, :suppressed
8
8
 
9
9
  def initialize(*args)
10
10
  @code = args.shift if args.count > 1
11
11
  message = args.shift
12
- @cause = args.shift
13
12
  @suppressed = args.shift
14
13
  super(message)
15
14
  end
@@ -6,7 +6,8 @@ module Neo4j
6
6
  module DurationNormalizer
7
7
  class << self
8
8
  def normalize(object)
9
- parts = object.parts
9
+ parts = object.parts.to_h
10
+ parts.default = 0
10
11
  months_i, months_remainder_seconds = divmod(months(parts), ActiveSupport::Duration::SECONDS_PER_MONTH)
11
12
  months_days, months_remainder_seconds =
12
13
  months_remainder_seconds.divmod(ActiveSupport::Duration::SECONDS_PER_DAY)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '4.1.0.beta.1'
5
+ VERSION = '4.2.0'
6
6
  end
7
7
  end
@@ -13,6 +13,7 @@ if RUBY_PLATFORM.match?(/java/)
13
13
  end
14
14
  # End workaround
15
15
 
16
+ require 'active_support/concern'
16
17
  require 'active_support/core_ext/hash/indifferent_access'
17
18
  require 'active_support/core_ext/numeric/time'
18
19
  require 'active_support/duration'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-java-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0.beta.1
4
+ version: 4.2.0
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-16 00:00:00.000000000 Z
11
+ date: 2021-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +249,6 @@ files:
249
249
  - lib/neo4j/driver/exceptions/transient_exception.rb
250
250
  - lib/neo4j/driver/exceptions/untrusted_server_exception.rb
251
251
  - lib/neo4j/driver/internal/duration_normalizer.rb
252
- - lib/neo4j/driver/internal/ruby_signature.rb
253
252
  - lib/neo4j/driver/internal/validator.rb
254
253
  - lib/neo4j/driver/types/bytes.rb
255
254
  - lib/neo4j/driver/types/local_date_time.rb
@@ -278,11 +277,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
277
  version: '2.5'
279
278
  required_rubygems_version: !ruby/object:Gem::Requirement
280
279
  requirements:
281
- - - ">"
280
+ - - ">="
282
281
  - !ruby/object:Gem::Version
283
- version: 1.3.1
282
+ version: '0'
284
283
  requirements:
285
- - jar org.neo4j.driver, neo4j-java-driver, 4.1.1
284
+ - jar org.neo4j.driver, neo4j-java-driver, 4.2.4
286
285
  rubygems_version: 3.0.6
287
286
  signing_key:
288
287
  specification_version: 4
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Neo4j
4
- module Driver
5
- module Internal
6
- module RubySignature
7
- class << self
8
- def session(args)
9
- [
10
- args.empty? || args.first.is_a?(String) ? Neo4j::Driver::AccessMode::WRITE : args.shift, # mode
11
- args # bookmarks
12
- ]
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end