neo4j-java-driver 0.1.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +8 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +68 -0
  5. data/Rakefile +16 -0
  6. data/jruby/neo4j/driver.rb +53 -0
  7. data/jruby/neo4j/driver/ext/exception_checkable.rb +21 -0
  8. data/jruby/neo4j/driver/ext/exception_mapper.rb +48 -0
  9. data/jruby/neo4j/driver/ext/graph_database.rb +56 -0
  10. data/jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb +17 -0
  11. data/jruby/neo4j/driver/ext/internal_driver.rb +18 -0
  12. data/jruby/neo4j/driver/ext/internal_record.rb +21 -0
  13. data/jruby/neo4j/driver/ext/internal_statement_result.rb +22 -0
  14. data/jruby/neo4j/driver/ext/map_accessor.rb +17 -0
  15. data/jruby/neo4j/driver/ext/ruby_converter.rb +55 -0
  16. data/jruby/neo4j/driver/ext/run_override.rb +73 -0
  17. data/jruby/neo4j/driver/ext/start_end_naming.rb +17 -0
  18. data/jruby/neo4j/driver/ext/statement.rb +13 -0
  19. data/lib/loader.rb +18 -0
  20. data/lib/neo4j/driver/auto_closable.rb +32 -0
  21. data/lib/neo4j/driver/exceptions/authentication_exception.rb +10 -0
  22. data/lib/neo4j/driver/exceptions/client_exception.rb +10 -0
  23. data/lib/neo4j/driver/exceptions/database_exception.rb +10 -0
  24. data/lib/neo4j/driver/exceptions/illegal_state_exception.rb +10 -0
  25. data/lib/neo4j/driver/exceptions/neo4j_exception.rb +18 -0
  26. data/lib/neo4j/driver/exceptions/no_such_record_exception.rb +33 -0
  27. data/lib/neo4j/driver/exceptions/protocol_exception.rb +10 -0
  28. data/lib/neo4j/driver/exceptions/security_exception.rb +10 -0
  29. data/lib/neo4j/driver/exceptions/service_unavailable_exception.rb +10 -0
  30. data/lib/neo4j/driver/exceptions/session_expired_exception.rb +10 -0
  31. data/lib/neo4j/driver/exceptions/transient_exception.rb +10 -0
  32. data/lib/neo4j/driver/exceptions/untrusted_server_exception.rb +10 -0
  33. data/lib/neo4j/driver/internal/duration_normalizer.rb +42 -0
  34. data/lib/neo4j/driver/internal/ruby_signature.rb +18 -0
  35. data/lib/neo4j/driver/types/byte_array.rb +17 -0
  36. data/lib/neo4j/driver/types/local_date_time.rb +20 -0
  37. data/lib/neo4j/driver/types/local_time.rb +19 -0
  38. data/lib/neo4j/driver/types/offset_time.rb +19 -0
  39. data/lib/neo4j/driver/types/point.rb +39 -0
  40. data/lib/neo4j/driver/types/time.rb +43 -0
  41. data/lib/neo4j/driver/version.rb +7 -0
  42. data/lib/neo4j_ruby_driver.rb +19 -0
  43. data/neo4j-ruby-driver.gemspec +63 -0
  44. metadata +216 -0
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Types
6
+ class OffsetTime < Time
7
+ class << self
8
+ FIELDS = %i[hour min sec nsec utc_offset].freeze
9
+
10
+ def significant_fields
11
+ FIELDS
12
+ end
13
+ end
14
+
15
+ delegate(*significant_fields, to: :@time)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Types
6
+ class Point
7
+ attr_accessor :srid, :x, :y, :z
8
+
9
+ SRID = {
10
+ 'WGS-84': 4326,
11
+ 'WGS-84-3D': 4979,
12
+ cartesian: 7203,
13
+ 'cartesian-3D': 9157
14
+ }.with_indifferent_access.freeze
15
+
16
+ def initialize(args)
17
+ self.x = args[:longitude] || args[:x]
18
+ self.y = args[:latitude] || args[:y]
19
+ self.z = args[:height] || args[:z]
20
+ self.srid = args[:srid] || SRID[args[:crs] || implied_crs(args[:longitude] || args[:latitude])]
21
+ end
22
+
23
+ def coordinates
24
+ [x, y, z].compact.map(&:to_f)
25
+ end
26
+
27
+ private
28
+
29
+ def implied_crs(geo)
30
+ if geo
31
+ z ? :'WGS-84-3D' : :'WGS-84'
32
+ else
33
+ z ? :'cartesian-3D' : :cartesian
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Types
6
+ class Time
7
+ include Comparable
8
+
9
+ delegate :hash, :to_a, to: :significant
10
+
11
+ class << self
12
+ def parse(date)
13
+ new(::Time.parse(date))
14
+ end
15
+ end
16
+
17
+ def initialize(time)
18
+ @time = time
19
+ end
20
+
21
+ def significant
22
+ self.class.significant_fields.map(&method(:send))
23
+ end
24
+
25
+ def <=>(other)
26
+ return unless other.is_a?(self.class)
27
+
28
+ self.class.significant_fields.reduce(0) do |acc, elem|
29
+ acc.zero? ? send(elem) <=> other.send(elem) : (break acc)
30
+ end
31
+ end
32
+
33
+ def eql?(other)
34
+ other.is_a?(self.class) && self.class.significant_fields.all? { |elem| send(elem).eql?(other.send(elem)) }
35
+ end
36
+
37
+ def +(numeric)
38
+ self.class.new(@time + numeric)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ VERSION = '0.1.1'
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Workaround for missing zeitwerk support in jruby-9.2.8.0
4
+ if RUBY_PLATFORM.match?(/java/)
5
+ module Neo4j
6
+ module Driver
7
+ module Exceptions
8
+ end
9
+ module Internal
10
+ end
11
+ end
12
+ end
13
+ end
14
+ # End workaround
15
+
16
+ require 'active_support/core_ext/hash/indifferent_access'
17
+ require 'active_support/duration'
18
+ require 'active_support/time'
19
+ require 'neo4j/driver'
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'neo4j/driver/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ ffi = ENV['SEABOLT_LIB']&.length&.positive?
9
+
10
+ spec.name = "neo4j-#{ffi ? :ruby : :java}-driver"
11
+ spec.version = Neo4j::Driver::VERSION
12
+ spec.authors = ['Heinrich Klobuczek']
13
+ spec.email = ['heinrich@mail.com']
14
+
15
+ spec.summary = 'neo4j ruby driver'
16
+ spec.homepage = 'https://github.com/neo4jrb/neo4j-ruby-driver'
17
+ spec.license = 'MIT'
18
+
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
20
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
21
+ if spec.respond_to?(:metadata)
22
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
23
+
24
+ spec.metadata['homepage_uri'] = spec.homepage
25
+ spec.metadata['source_code_uri'] = 'https://github.com/neo4jrb/neo4j-ruby-driver'
26
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
27
+ else
28
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
29
+ 'public gem pushes.'
30
+ end
31
+
32
+ # Specify which files should be added to the gem when it is released.
33
+ spec.files << Dir[*%w[neo4j-ruby-driver.gemspec Rakefile README.md LICENSE.txt Gemfile lib/neo4j_ruby_driver.rb lib/loader.rb]]
34
+
35
+ pdir = ffi ? 'ffi' : 'jruby'
36
+
37
+ spec.files << Dir['lib/neo4j/**/*.rb']
38
+ spec.files << Dir["#{pdir}/**/*.rb"]
39
+
40
+ spec.bindir = 'exe'
41
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
42
+ spec.require_paths = ['lib', pdir]
43
+
44
+ spec.platform = 'java' if RUBY_PLATFORM.match?(/java/)
45
+
46
+ if ffi
47
+ spec.add_runtime_dependency 'ffi'
48
+ spec.add_runtime_dependency 'recursive-open-struct'
49
+ else
50
+ spec.add_runtime_dependency 'jar-dependencies'
51
+ spec.requirements << 'jar org.neo4j.driver, neo4j-java-driver, 1.7.5'
52
+ # avoids to install it on the fly when jar-dependencies needs it
53
+ spec.add_development_dependency 'ruby-maven'
54
+ end
55
+
56
+ spec.add_runtime_dependency 'activesupport'
57
+ spec.add_runtime_dependency 'zeitwerk'
58
+ spec.add_development_dependency 'bundler'
59
+ spec.add_development_dependency 'neo4j-rake_tasks', '>= 0.3.0'
60
+ spec.add_development_dependency 'parallel'
61
+ spec.add_development_dependency 'rake'
62
+ spec.add_development_dependency 'rspec-its'
63
+ end
metadata ADDED
@@ -0,0 +1,216 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: neo4j-java-driver
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: java
6
+ authors:
7
+ - Heinrich Klobuczek
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: jar-dependencies
20
+ prerelease: false
21
+ type: :runtime
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ name: ruby-maven
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ name: activesupport
48
+ prerelease: false
49
+ type: :runtime
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: zeitwerk
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: bundler
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 0.3.0
89
+ name: neo4j-rake_tasks
90
+ prerelease: false
91
+ type: :development
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 0.3.0
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ name: parallel
104
+ prerelease: false
105
+ type: :development
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ name: rake
118
+ prerelease: false
119
+ type: :development
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ name: rspec-its
132
+ prerelease: false
133
+ type: :development
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - heinrich@mail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - Gemfile
147
+ - LICENSE.txt
148
+ - README.md
149
+ - Rakefile
150
+ - jruby/neo4j/driver.rb
151
+ - jruby/neo4j/driver/ext/exception_checkable.rb
152
+ - jruby/neo4j/driver/ext/exception_mapper.rb
153
+ - jruby/neo4j/driver/ext/graph_database.rb
154
+ - jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb
155
+ - jruby/neo4j/driver/ext/internal_driver.rb
156
+ - jruby/neo4j/driver/ext/internal_record.rb
157
+ - jruby/neo4j/driver/ext/internal_statement_result.rb
158
+ - jruby/neo4j/driver/ext/map_accessor.rb
159
+ - jruby/neo4j/driver/ext/ruby_converter.rb
160
+ - jruby/neo4j/driver/ext/run_override.rb
161
+ - jruby/neo4j/driver/ext/start_end_naming.rb
162
+ - jruby/neo4j/driver/ext/statement.rb
163
+ - lib/loader.rb
164
+ - lib/neo4j/driver/auto_closable.rb
165
+ - lib/neo4j/driver/exceptions/authentication_exception.rb
166
+ - lib/neo4j/driver/exceptions/client_exception.rb
167
+ - lib/neo4j/driver/exceptions/database_exception.rb
168
+ - lib/neo4j/driver/exceptions/illegal_state_exception.rb
169
+ - lib/neo4j/driver/exceptions/neo4j_exception.rb
170
+ - lib/neo4j/driver/exceptions/no_such_record_exception.rb
171
+ - lib/neo4j/driver/exceptions/protocol_exception.rb
172
+ - lib/neo4j/driver/exceptions/security_exception.rb
173
+ - lib/neo4j/driver/exceptions/service_unavailable_exception.rb
174
+ - lib/neo4j/driver/exceptions/session_expired_exception.rb
175
+ - lib/neo4j/driver/exceptions/transient_exception.rb
176
+ - lib/neo4j/driver/exceptions/untrusted_server_exception.rb
177
+ - lib/neo4j/driver/internal/duration_normalizer.rb
178
+ - lib/neo4j/driver/internal/ruby_signature.rb
179
+ - lib/neo4j/driver/types/byte_array.rb
180
+ - lib/neo4j/driver/types/local_date_time.rb
181
+ - lib/neo4j/driver/types/local_time.rb
182
+ - lib/neo4j/driver/types/offset_time.rb
183
+ - lib/neo4j/driver/types/point.rb
184
+ - lib/neo4j/driver/types/time.rb
185
+ - lib/neo4j/driver/version.rb
186
+ - lib/neo4j_ruby_driver.rb
187
+ - neo4j-ruby-driver.gemspec
188
+ homepage: https://github.com/neo4jrb/neo4j-ruby-driver
189
+ licenses:
190
+ - MIT
191
+ metadata:
192
+ allowed_push_host: https://rubygems.org/
193
+ homepage_uri: https://github.com/neo4jrb/neo4j-ruby-driver
194
+ source_code_uri: https://github.com/neo4jrb/neo4j-ruby-driver
195
+ post_install_message:
196
+ rdoc_options: []
197
+ require_paths:
198
+ - lib
199
+ - jruby
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ">="
203
+ - !ruby/object:Gem::Version
204
+ version: '0'
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ requirements:
211
+ - jar org.neo4j.driver, neo4j-java-driver, 1.7.5
212
+ rubygems_version: 3.0.6
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: neo4j ruby driver
216
+ test_files: []