neo4j-core 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/neo4j-core/graph_json.rb +35 -0
- data/lib/neo4j-core/version.rb +1 -1
- data/lib/neo4j-server/cypher_authentication.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f120e51e4cad5a823eddff19a559434f37d2a034
|
4
|
+
data.tar.gz: 88f38c4b8ac0f30c687a97c66569d973bf22d57c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97346a8df60110a0af61e9ee819767df813fdb91be59489d6a740fa9c5cbfa196ada9447eb80a4b8a74a92561a6782f27e9cdd20aac8f6a1fd58a8155db2ad65
|
7
|
+
data.tar.gz: 52876941d4cae63aee341d86ed9da5bae04550b9dd06c6c60208959d9c09a602376c6e1736939e6f87240fc1a2fa41deb8fd06e7b7f32003edd5cb5a10aa870c
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Neo4j
|
2
|
+
module Core
|
3
|
+
module GraphJSON
|
4
|
+
def self.to_graph_json(objects)
|
5
|
+
nodes = {}
|
6
|
+
edges = {}
|
7
|
+
|
8
|
+
objects.each do |object|
|
9
|
+
case object
|
10
|
+
when Neo4j::ActiveNode, Neo4j::Server::CypherNode
|
11
|
+
nodes[object.neo_id] = {
|
12
|
+
id: object.neo_id,
|
13
|
+
labels: (object.is_a?(Neo4j::ActiveNode) ? [object.class.name] : object.labels),
|
14
|
+
properties: object.attributes
|
15
|
+
}
|
16
|
+
when Neo4j::ActiveRel, Neo4j::Server::CypherRelationship
|
17
|
+
edges[[object.start_node.neo_id, object.end_node.neo_id]] = {
|
18
|
+
source: object.start_node.neo_id,
|
19
|
+
target: object.end_node.neo_id,
|
20
|
+
type: object.rel_type,
|
21
|
+
properties: object.props
|
22
|
+
}
|
23
|
+
else
|
24
|
+
fail "Invalid value found: #{object.inspect}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
{
|
29
|
+
nodes: nodes.values,
|
30
|
+
edges: edges.values
|
31
|
+
}.to_json
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/neo4j-core/version.rb
CHANGED
@@ -37,7 +37,7 @@ module Neo4j
|
|
37
37
|
# @return [String] An access token provided by the server.
|
38
38
|
def authenticate
|
39
39
|
auth_response = auth_connection("#{url}/authentication")
|
40
|
-
auth_hash = if auth_response.body.empty?
|
40
|
+
auth_hash = if auth_response.status == 404 || auth_response.body.empty?
|
41
41
|
nil
|
42
42
|
elsif auth_response.body.is_a?(String)
|
43
43
|
JSON.parse(auth_response.body)['errors'][0]['code'] == 'Neo.ClientError.Security.AuthorizationFailed' ? auth_attempt : nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Chris Grigg, Brian Underwood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/neo4j-core.rb
|
220
220
|
- lib/neo4j-core/active_entity.rb
|
221
221
|
- lib/neo4j-core/cypher_translator.rb
|
222
|
+
- lib/neo4j-core/graph_json.rb
|
222
223
|
- lib/neo4j-core/hash_with_indifferent_access.rb
|
223
224
|
- lib/neo4j-core/helpers.rb
|
224
225
|
- lib/neo4j-core/label.rb
|
@@ -286,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
286
287
|
version: '0'
|
287
288
|
requirements: []
|
288
289
|
rubyforge_project:
|
289
|
-
rubygems_version: 2.4.
|
290
|
+
rubygems_version: 2.4.3
|
290
291
|
signing_key:
|
291
292
|
specification_version: 4
|
292
293
|
summary: A basic library to work with the graph database Neo4j.
|