neography 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
 - data/lib/neography/connection.rb +9 -3
 - data/lib/neography/path_traverser.rb +6 -5
 - data/lib/neography/tasks.rb +1 -1
 - data/lib/neography/version.rb +1 -1
 - data/spec/integration/rest_index_spec.rb +10 -0
 - metadata +2 -2
 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/lib/neography/connection.rb
    CHANGED
    
    | 
         @@ -105,9 +105,15 @@ module Neography 
     | 
|
| 
       105 
105 
     | 
    
         
             
                end
         
     | 
| 
       106 
106 
     | 
    
         | 
| 
       107 
107 
     | 
    
         
             
                def handle_4xx_500_response(code, body)
         
     | 
| 
       108 
     | 
    
         
            -
                   
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 108 
     | 
    
         
            +
                  if body.nil? or body == ""
         
     | 
| 
      
 109 
     | 
    
         
            +
                    parsed_body = {}
         
     | 
| 
      
 110 
     | 
    
         
            +
                    message = "No error message returned from server."
         
     | 
| 
      
 111 
     | 
    
         
            +
                    stacktrace = ""
         
     | 
| 
      
 112 
     | 
    
         
            +
                  else
         
     | 
| 
      
 113 
     | 
    
         
            +
                    parsed_body = JSON.parse(body)
         
     | 
| 
      
 114 
     | 
    
         
            +
                    message = parsed_body["message"]
         
     | 
| 
      
 115 
     | 
    
         
            +
                    stacktrace = parsed_body["stacktrace"]
         
     | 
| 
      
 116 
     | 
    
         
            +
                  end
         
     | 
| 
       111 
117 
     | 
    
         | 
| 
       112 
118 
     | 
    
         
             
                  @logger.error "#{code} error: #{body}" if @log_enabled
         
     | 
| 
       113 
119 
     | 
    
         | 
| 
         @@ -14,7 +14,8 @@ module Neography 
     | 
|
| 
       14 
14 
     | 
    
         
             
                    @relationships << {"type" => type.to_s, "direction" => dir.to_s }
         
     | 
| 
       15 
15 
     | 
    
         
             
                  end unless types.nil?
         
     | 
| 
       16 
16 
     | 
    
         
             
                  @get = ["node","rel"]
         
     | 
| 
       17 
     | 
    
         
            -
                  @ 
     | 
| 
      
 17 
     | 
    
         
            +
                  @loaded_nodes = Array.new
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @loaded_rels = Array.new
         
     | 
| 
       18 
19 
     | 
    
         
             
                end
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
21 
     | 
    
         
             
                def nodes
         
     | 
| 
         @@ -62,15 +63,15 @@ module Neography 
     | 
|
| 
       62 
63 
     | 
    
         | 
| 
       63 
64 
     | 
    
         
             
                    if @get.include?("node")
         
     | 
| 
       64 
65 
     | 
    
         
             
                      path["nodes"].each_with_index do |n, i|
         
     | 
| 
       65 
     | 
    
         
            -
                        @ 
     | 
| 
       66 
     | 
    
         
            -
                        paths[i * 2] =  @ 
     | 
| 
      
 66 
     | 
    
         
            +
                        @loaded_nodes[n.split('/').last.to_i] = Neography::Node.load(n) if @loaded_nodes.at(n.split('/').last.to_i).nil?
         
     | 
| 
      
 67 
     | 
    
         
            +
                        paths[i * 2] =  @loaded_nodes[n.split('/').last.to_i]
         
     | 
| 
       67 
68 
     | 
    
         
             
                      end
         
     | 
| 
       68 
69 
     | 
    
         
             
                    end
         
     | 
| 
       69 
70 
     | 
    
         | 
| 
       70 
71 
     | 
    
         
             
                    if @get.include?("rel") 
         
     | 
| 
       71 
72 
     | 
    
         
             
                      path["relationships"].each_with_index do |r, i|
         
     | 
| 
       72 
     | 
    
         
            -
                        @ 
     | 
| 
       73 
     | 
    
         
            -
                        paths[i * 2 + 1] =  @ 
     | 
| 
      
 73 
     | 
    
         
            +
                        @loaded_rels[r.split('/').last.to_i] = Neography::Relationship.load(r)  if @loaded_rels.at(r.split('/').last.to_i).nil?
         
     | 
| 
      
 74 
     | 
    
         
            +
                        paths[i * 2 + 1] =  @loaded_rels[r.split('/').last.to_i]
         
     | 
| 
       74 
75 
     | 
    
         
             
                      end
         
     | 
| 
       75 
76 
     | 
    
         
             
                    end
         
     | 
| 
       76 
77 
     | 
    
         | 
    
        data/lib/neography/tasks.rb
    CHANGED
    
    | 
         @@ -4,7 +4,7 @@ require 'os' 
     | 
|
| 
       4 
4 
     | 
    
         
             
            namespace :neo4j do
         
     | 
| 
       5 
5 
     | 
    
         
             
              desc "Install Neo4j"
         
     | 
| 
       6 
6 
     | 
    
         
             
              task :install, :edition, :version do |t, args|
         
     | 
| 
       7 
     | 
    
         
            -
                args.with_defaults(:edition => "community", :version => "1.8. 
     | 
| 
      
 7 
     | 
    
         
            +
                args.with_defaults(:edition => "community", :version => "1.8.2")
         
     | 
| 
       8 
8 
     | 
    
         
             
                puts "Installing Neo4j-#{args[:edition]}-#{args[:version]}"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                if OS::Underlying.windows?
         
     | 
    
        data/lib/neography/version.rb
    CHANGED
    
    
| 
         @@ -167,6 +167,16 @@ describe Neography::Rest do 
     | 
|
| 
       167 
167 
     | 
    
         
             
                  new_index = @neo.get_relationship_index("test_relationship_index", key, value) 
         
     | 
| 
       168 
168 
     | 
    
         
             
                  new_index.should be_nil
         
     | 
| 
       169 
169 
     | 
    
         
             
                end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                it "throws an error when there is an empty string in the value when removing a node" do
         
     | 
| 
      
 172 
     | 
    
         
            +
                  new_node = @neo.create_node
         
     | 
| 
      
 173 
     | 
    
         
            +
                  key = generate_text(6)
         
     | 
| 
      
 174 
     | 
    
         
            +
                  value = generate_text
         
     | 
| 
      
 175 
     | 
    
         
            +
                  @neo.add_node_to_index("test_node_index", key, value, new_node) 
         
     | 
| 
      
 176 
     | 
    
         
            +
                  new_index = @neo.get_node_index("test_node_index", key, value) 
         
     | 
| 
      
 177 
     | 
    
         
            +
                  new_index.should_not be_nil
         
     | 
| 
      
 178 
     | 
    
         
            +
                  expect { @neo.remove_node_from_index("test_node_index", key, "", new_node) }.to raise_error Neography::NeographyError
         
     | 
| 
      
 179 
     | 
    
         
            +
                end
         
     | 
| 
       170 
180 
     | 
    
         
             
              end
         
     | 
| 
       171 
181 
     | 
    
         | 
| 
       172 
182 
     | 
    
         
             
              describe "get index" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: neography
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.7
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-02-28 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rspec
         
     |