neo4j-java-driver 0.1.3-java → 0.1.4-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: a7d48cf110a31752f20df26b304f6c5c8e418b5a1a79b4ddbb164c4d642f6cc5
4
- data.tar.gz: a28b7449716f5b28801512b379f9321285bd1715611795d5156e80152f375d85
3
+ metadata.gz: e64d98be60f1b75e5495befe5ba268394f53b387077c4ad2fb71b1731c35ab1b
4
+ data.tar.gz: d8b5047b00a9caec9c288533ac3da1faada25cd95016e3652bffb16dc704eae2
5
5
  SHA512:
6
- metadata.gz: 1417cf6bef2c9e9f8fdcf0694307409eb9c358b272fc6b5252ff3ef542bd555e50cedb35c3371df304d1bdb09f8f9525f57e7863aad2078c34bb24a16e747289
7
- data.tar.gz: ba3c8e6f803be565857afa651afdae49b93f682e7f0a8e36904f8b38f74aa23d9d3fffcfeb2151475085c260df335574549c94f6470781f950875e29a18a14fc
6
+ metadata.gz: 5efba2378a63feaeef92f4d03a38dc4199eb6ac0befac7222b68aab822a4135c9975c6e6d98baef1038595ac60b96cc954571df805e7acc529bba6eb76965cfb
7
+ data.tar.gz: d0f6a85e88fd3dfa249f24057f98bef0d9c5d0576347d6c2e195ed8300e777a26d1b07da1e234b4e08f1f4224b74e68bfb5ae25b9eeb06ab4b86d1d0fc700a58
@@ -49,6 +49,7 @@ Java::OrgNeo4jDriverInternal::ExplicitTransaction.prepend Neo4j::Driver::Ext::Ru
49
49
  Java::OrgNeo4jDriverInternal::NetworkSession.prepend Neo4j::Driver::Ext::RunOverride
50
50
  Java::OrgNeo4jDriverInternalSummary::InternalResultSummary.prepend Neo4j::Driver::Ext::Internal::Summary::InternalResultSummary
51
51
  Java::OrgNeo4jDriverInternalValue::ValueAdapter.include Neo4j::Driver::Ext::RubyConverter
52
+ Java::OrgNeo4jDriverV1::AuthTokens.singleton_class.prepend Neo4j::Driver::Ext::AuthTokens
52
53
  Java::OrgNeo4jDriverV1::GraphDatabase.singleton_class.prepend Neo4j::Driver::Ext::GraphDatabase
53
54
  Java::OrgNeo4jDriverV1::Statement.prepend Neo4j::Driver::Ext::Statement
54
55
  Java::OrgNeo4jDriverV1Exceptions::Neo4jException.include Neo4j::Driver::Ext::ExceptionMapper
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module AuthTokens
7
+ def basic(username, password)
8
+ Neo4j::Driver::Internal::Validator.require_non_nil_credentials!(username, password)
9
+ super
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -7,7 +7,7 @@ module Neo4j
7
7
  include Enumerable
8
8
  include ExceptionCheckable
9
9
 
10
- %i[has_next? next keys single consume summary].each do |method|
10
+ %i[has_next? next keys single consume summary peek].each do |method|
11
11
  define_method(method) do |*args, &block|
12
12
  check { super(*args, &block) }
13
13
  end
@@ -12,14 +12,16 @@ module Neo4j
12
12
  # work around jruby issue https://github.com/jruby/jruby/issues/5603
13
13
  Struct.new('Wrapper', :object)
14
14
 
15
- def write_transaction
16
- check { super { |tx| Struct::Wrapper.new(yield(tx)) }.object }
15
+ %i[read write].each do |prefix|
16
+ define_method("#{prefix}_transaction") do |&block|
17
+ check { super { |tx| Struct::Wrapper.new(block.call(tx)) }.object }
18
+ end
17
19
  end
18
20
 
19
21
  # end work around
20
22
 
21
23
  def run(statement, parameters = {})
22
- Neo4j::Driver::Internal::StatementValidator.validate!(parameters)
24
+ Neo4j::Driver::Internal::Validator.require_hash_parameters!(parameters)
23
25
  check do
24
26
  java_method(:run, [org.neo4j.driver.v1.Statement])
25
27
  .call(Neo4j::Driver::Statement.new(statement, to_neo(parameters)))
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Internal
6
+ module Validator
7
+ def self.require_hash_parameters!(parameters)
8
+ require_hash!(parameters) do
9
+ "The parameters should be provided as Map type. Unsupported parameters type: #{parameters.class.name}"
10
+ end
11
+ end
12
+
13
+ def self.require_hash!(obj)
14
+ raise(ArgumentError, yield) unless obj.nil? || obj.is_a?(Hash)
15
+ end
16
+
17
+ def self.require_non_nil!(obj, message)
18
+ raise ArgumentError, message if obj.nil?
19
+ end
20
+
21
+ def self.require_non_nil_credentials!(username, password)
22
+ require_non_nil! username, "Username can't be nil"
23
+ require_non_nil! password, "Password can't be nil"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
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: 0.1.3
4
+ version: 0.1.4
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +210,7 @@ files:
210
210
  - LICENSE.txt
211
211
  - README.md
212
212
  - jruby/neo4j/driver.rb
213
+ - jruby/neo4j/driver/ext/auth_tokens.rb
213
214
  - jruby/neo4j/driver/ext/exception_checkable.rb
214
215
  - jruby/neo4j/driver/ext/exception_mapper.rb
215
216
  - jruby/neo4j/driver/ext/graph_database.rb
@@ -240,7 +241,7 @@ files:
240
241
  - lib/neo4j/driver/exceptions/untrusted_server_exception.rb
241
242
  - lib/neo4j/driver/internal/duration_normalizer.rb
242
243
  - lib/neo4j/driver/internal/ruby_signature.rb
243
- - lib/neo4j/driver/internal/statement_validator.rb
244
+ - lib/neo4j/driver/internal/validator.rb
244
245
  - lib/neo4j/driver/types/bytes.rb
245
246
  - lib/neo4j/driver/types/local_date_time.rb
246
247
  - lib/neo4j/driver/types/local_time.rb
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Neo4j
4
- module Driver
5
- module Internal
6
- module StatementValidator
7
- def self.validate!(parameters)
8
- unless parameters.nil? || parameters.is_a?(Hash)
9
- raise ArgumentError,
10
- "The parameters should be provided as Map type. Unsupported parameters type: #{parameters.class.name}"
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end