neo4j-core 5.0.0.rc.4 → 5.0.0

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
  SHA1:
3
- metadata.gz: af03b69f505c6ef9e583acb0e392daa6550c30c5
4
- data.tar.gz: d6d91dec745200ebb3877f3bd76b597408fa66ab
3
+ metadata.gz: 04ea30646a9dcb4a050cc2a47c0097eae8e37a9c
4
+ data.tar.gz: ebb218d8a7280c2f01558cfa24677de1fedd928e
5
5
  SHA512:
6
- metadata.gz: e6a95cc4aa65f54ea657b87225c9a9bd50e27653d658f56f468594eb03df9f7118b75063e618597197a3d77cd1e8c90489061b18e181bcf0a014ef7ca6f416e5
7
- data.tar.gz: f5a5a49f5880f493567b1e9cffded59b7666d2e81046e13fc58fc9e9ae7a9a46669dcd4cf7281d5a097fb2c39bf6929250a0c2e807849f38a1795d25d2def5de
6
+ metadata.gz: 7652c31855d074b39bdc45f481a2a0e785db6a056b114158a6f045eed8d745e97da899c7ae66d1a7e052c9e80cf6c9a55597abaaf7cce682054728f836868b39
7
+ data.tar.gz: bd8d1bf52c9e8b76c0d7ee5bdfb85ffffe2d24f0ccdb167c7a305318c878d982640d4ac218e9272ee5056d1bf34f6940fd660d30019bb2a18c5509e4e7e36d7b
@@ -1,5 +1,5 @@
1
1
  module Neo4j
2
2
  module Core
3
- VERSION = '5.0.0.rc.4'
3
+ VERSION = '5.0.0'
4
4
  end
5
5
  end
@@ -57,7 +57,7 @@ module Neo4j
57
57
 
58
58
  def unwrap(value)
59
59
  if !value.nil? && value.respond_to?(:to_a)
60
- value.map { |v| unwrap(v) }
60
+ value.respond_to?(:to_hash) ? value.to_hash : value.map { |v| unwrap(v) }
61
61
  else
62
62
  (!value.respond_to?(:wrapper) || unwrapped?) ? value : value.wrapper
63
63
  end
@@ -75,7 +75,7 @@ module Neo4j
75
75
  end
76
76
 
77
77
  def map_row_value(value, session)
78
- if value.is_a?(Hash)
78
+ if value.is_a?(Hash) && looks_like_an_object?(value)
79
79
  hash_value_as_object(value, session)
80
80
  elsif value.is_a?(Array)
81
81
  value.map! { |v| map_row_value(v, session) }
@@ -99,6 +99,14 @@ module Neo4j
99
99
  unwrapped? ? basic_obj : basic_obj.wrapper
100
100
  end
101
101
 
102
+ def looks_like_an_object?(value)
103
+ if transaction_response?
104
+ mapped_rest_data[:outgoing_relationships] || (mapped_rest_data[:start] && mapped_rest_data[:properties])
105
+ else
106
+ value[:labels] || value[:type]
107
+ end
108
+ end
109
+
102
110
  def unwrapped!
103
111
  @_unwrapped_obj = true
104
112
  end
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: 5.0.0.rc.4
4
+ version: 5.0.0
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-06-05 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -262,7 +262,6 @@ files:
262
262
  - lib/neo4j-core.rb
263
263
  - lib/neo4j-core/active_entity.rb
264
264
  - lib/neo4j-core/cypher_translator.rb
265
- - lib/neo4j-core/graph_json.rb
266
265
  - lib/neo4j-core/hash_with_indifferent_access.rb
267
266
  - lib/neo4j-core/helpers.rb
268
267
  - lib/neo4j-core/label.rb
@@ -326,9 +325,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
326
325
  version: 1.9.3
327
326
  required_rubygems_version: !ruby/object:Gem::Requirement
328
327
  requirements:
329
- - - ">"
328
+ - - ">="
330
329
  - !ruby/object:Gem::Version
331
- version: 1.3.1
330
+ version: '0'
332
331
  requirements: []
333
332
  rubyforge_project:
334
333
  rubygems_version: 2.4.5
@@ -1,35 +0,0 @@
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