Skip to content

Commit

Permalink
Merge branch '5.1.x'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/neo4j-core/version.rb
  • Loading branch information
cheerfulstoic committed Sep 29, 2015
2 parents 8d255fe + 1bc1dcc commit 1af25a3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 11 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]

## [5.1.6] - 2015-09-29

### Fixed
- Fix identification of objects returned from Neo4j which look like nodes or relationships

## [5.1.5] - 2015-09-27

### Changed
- Update `neo4j-rake_tasks` version (which now adds the `console` task)

## [5.1.4] - 2015-09-24

### Changed
Expand Down
35 changes: 25 additions & 10 deletions lib/neo4j-server/cypher_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,34 @@ def map_row_value(value, session)
end

def hash_value_as_object(value, session)
data = case
when transaction_response?
add_transaction_entity_id
mapped_rest_data
when value[:labels] || value[:type]
add_entity_id(value)
value
else
return value
end
if transaction_response?
add_transaction_entity_id
data = mapped_rest_data
elsif [:node, :relationship].include?(identify_entity(value))
add_entity_id(value)
data = value
else
return value
end

basic_obj = (node?(value) ? CypherNode : CypherRelationship).new(session, data)
unwrapped? ? basic_obj : basic_obj.wrapper
end

def identify_entity(data)
self_string = data[:self]
if self_string
type = self_string.split('/')[-2]
if type == 'node'
:node
elsif type == 'relationship'
:relationship
end
elsif [:nodes, :relationships, :start, :end, :length].all? { |k| data.key?(k) }
:path
end
end

def looks_like_an_object?(value)
if transaction_response?
mapped_rest_data[:outgoing_relationships] || (mapped_rest_data[:start] && mapped_rest_data[:properties])
Expand Down Expand Up @@ -272,3 +286,4 @@ def mapped_rest_data
end
end
end

2 changes: 1 addition & 1 deletion neo4j-core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Neo4j-core provides classes and methods to work with the graph database Neo4j.
s.add_dependency('activesupport') # For ActiveSupport::Notifications
s.add_dependency('multi_json')
s.add_dependency('faraday_middleware-multi_json')
s.add_dependency('neo4j-rake_tasks', '~> 0.1.0')
s.add_dependency('neo4j-rake_tasks', '~> 0.2.0')

s.add_development_dependency('pry')
s.add_development_dependency('yard')
Expand Down

0 comments on commit 1af25a3

Please sign in to comment.